Skip to content

Commit

Permalink
More recursion
Browse files Browse the repository at this point in the history
  • Loading branch information
koyuawsmbrtn committed Jan 12, 2024
1 parent adc9b4c commit 60c21d5
Showing 1 changed file with 69 additions and 0 deletions.
69 changes: 69 additions & 0 deletions PlaySync/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,75 @@ private void syncToDevice(object status)
}
}
}
foreach (string subfolder in Directory.GetDirectories(folder))
{
string subfolderName = subfolder.Replace(folder + "\\", "");
if (!Directory.Exists(Path.Combine(playdatedrive, "Games", gameName, folderName, subfolderName)))
{
Directory.CreateDirectory(Path.Combine(playdatedrive, "Games", gameName, folderName, subfolderName));
}
foreach (string file in Directory.GetFiles(subfolder))
{
string fileName = file.Replace(subfolder + "\\", "");
if (!File.Exists(Path.Combine(playdatedrive, "Games", gameName, folderName, subfolderName, fileName)))
{
File.Copy(file, Path.Combine(playdatedrive, "Games", gameName, folderName, subfolderName, fileName));
}
else
{
if (File.GetLastWriteTime(file) > File.GetLastWriteTime(Path.Combine(playdatedrive, "Games", gameName, folderName, subfolderName, fileName)))
{
File.Copy(file, Path.Combine(playdatedrive, "Games", gameName, folderName, subfolderName, fileName), true);
}
}
}
foreach (string subsubfolder in Directory.GetDirectories(subfolder))
{
string subsubfolderName = subsubfolder.Replace(subfolder + "\\", "");
if (!Directory.Exists(Path.Combine(playdatedrive, "Games", gameName, folderName, subfolderName, subsubfolderName)))
{
Directory.CreateDirectory(Path.Combine(playdatedrive, "Games", gameName, folderName, subfolderName, subsubfolderName));
}
foreach (string file in Directory.GetFiles(subsubfolder))
{
string fileName = file.Replace(subsubfolder + "\\", "");
if (!File.Exists(Path.Combine(playdatedrive, "Games", gameName, folderName, subfolderName, subsubfolderName, fileName)))
{
File.Copy(file, Path.Combine(playdatedrive, "Games", gameName, folderName, subfolderName, subsubfolderName, fileName));
}
else
{
if (File.GetLastWriteTime(file) > File.GetLastWriteTime(Path.Combine(playdatedrive, "Games", gameName, folderName, subfolderName, subsubfolderName, fileName)))
{
File.Copy(file, Path.Combine(playdatedrive, "Games", gameName, folderName, subfolderName, subsubfolderName, fileName), true);
}
}
}
foreach (string subsubsubfolder in Directory.GetDirectories(subsubfolder))
{
string subsubsubfolderName = subsubsubfolder.Replace(subsubfolder + "\\", "");
if (!Directory.Exists(Path.Combine(playdatedrive, "Games", gameName, folderName, subfolderName, subsubfolderName, subsubsubfolderName)))
{
Directory.CreateDirectory(Path.Combine(playdatedrive, "Games", gameName, folderName, subfolderName, subsubfolderName, subsubsubfolderName));
}
foreach (string file in Directory.GetFiles(subsubsubfolder))
{
string fileName = file.Replace(subsubsubfolder + "\\", "");
if (!File.Exists(Path.Combine(playdatedrive, "Games", gameName, folderName, subfolderName, subsubfolderName, subsubsubfolderName, fileName)))
{
File.Copy(file, Path.Combine(playdatedrive, "Games", gameName, folderName, subfolderName, subsubfolderName, subsubsubfolderName, fileName));
}
else
{
if (File.GetLastWriteTime(file) > File.GetLastWriteTime(Path.Combine(playdatedrive, "Games", gameName, folderName, subfolderName, subsubfolderName, subsubsubfolderName, fileName)))
{
File.Copy(file, Path.Combine(playdatedrive, "Games", gameName, folderName, subfolderName, subsubfolderName, subsubsubfolderName, fileName), true);
}
}
}
}
}
}
}
}
catch { }
Expand Down

0 comments on commit 60c21d5

Please sign in to comment.