Relative path enhancement
Switch to Card Not Mapped
This commit is contained in:
@ -3,6 +3,32 @@ namespace File_Folder_Helper.Helpers;
|
||||
internal static class HelperTooLong
|
||||
{
|
||||
|
||||
internal static void TooLong(string workingDirectory, bool delete)
|
||||
{
|
||||
string[] files;
|
||||
string destination;
|
||||
string? parentDirectory;
|
||||
string[] directories = Directory.GetDirectories(workingDirectory, "*", SearchOption.TopDirectoryOnly);
|
||||
for (int i = 0; i < directories.Length; i++)
|
||||
{
|
||||
if (delete)
|
||||
{
|
||||
Directory.Delete(directories[i], recursive: true);
|
||||
break;
|
||||
}
|
||||
files = Directory.GetFiles(directories[i], "*", SearchOption.TopDirectoryOnly);
|
||||
for (int f = 0; f < files.Length; f++)
|
||||
File.Delete(files[f]);
|
||||
parentDirectory = Path.GetDirectoryName(directories[i]);
|
||||
if (string.IsNullOrEmpty(parentDirectory))
|
||||
continue;
|
||||
destination = Path.Combine(parentDirectory, i.ToString());
|
||||
if (Path.GetFileName(directories[i]).Length > 3)
|
||||
Directory.Move(directories[i], destination);
|
||||
TooLong(destination, delete);
|
||||
}
|
||||
}
|
||||
|
||||
private static void MoveFiles(string yearName, string personKeyFormattedDirectory, string personNameDirectory, string personNameDirectoryName)
|
||||
{
|
||||
string? checkFile;
|
||||
@ -85,30 +111,4 @@ internal static class HelperTooLong
|
||||
_ = HelperDeleteEmptyDirectories.DeleteEmptyDirectories(directory);
|
||||
}
|
||||
|
||||
internal static void TooLong(string workingDirectory, bool delete)
|
||||
{
|
||||
string[] files;
|
||||
string destination;
|
||||
string? parentDirectory;
|
||||
string[] directories = Directory.GetDirectories(workingDirectory, "*", SearchOption.TopDirectoryOnly);
|
||||
for (int i = 0; i < directories.Length; i++)
|
||||
{
|
||||
if (delete)
|
||||
{
|
||||
Directory.Delete(directories[i], recursive: true);
|
||||
break;
|
||||
}
|
||||
files = Directory.GetFiles(directories[i], "*", SearchOption.TopDirectoryOnly);
|
||||
for (int f = 0; f < files.Length; f++)
|
||||
File.Delete(files[f]);
|
||||
parentDirectory = Path.GetDirectoryName(directories[i]);
|
||||
if (string.IsNullOrEmpty(parentDirectory))
|
||||
continue;
|
||||
destination = Path.Combine(parentDirectory, i.ToString());
|
||||
if (Path.GetFileName(directories[i]).Length > 3)
|
||||
Directory.Move(directories[i], destination);
|
||||
TooLong(destination, delete);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user