Individually First Pass
This commit is contained in:
@ -126,6 +126,7 @@ public class Rename
|
||||
string fileName;
|
||||
string? message;
|
||||
string checkFile;
|
||||
string? directory;
|
||||
TimeSpan timeSpan;
|
||||
DateTime? dateTime;
|
||||
DateTime?[] dateTimes;
|
||||
@ -143,6 +144,20 @@ public class Rename
|
||||
{
|
||||
progressBar.Tick();
|
||||
fileHolder = new(file);
|
||||
if (file.EndsWith(".rename"))
|
||||
{
|
||||
directory = Path.GetDirectoryName(file);
|
||||
if (string.IsNullOrEmpty(directory))
|
||||
continue;
|
||||
checkFile = Path.Combine(directory, $"rename_{Path.GetFileName(file[..^7])}");
|
||||
if (File.Exists(checkFile))
|
||||
continue;
|
||||
if (distinct.Contains(checkFile))
|
||||
continue;
|
||||
distinct.Add(checkFile);
|
||||
results.Add(new(fileHolder, checkFile));
|
||||
continue;
|
||||
}
|
||||
if (file.EndsWith(".jpg.del"))
|
||||
{
|
||||
checkFile = file[..^4];
|
||||
@ -391,17 +406,20 @@ public class Rename
|
||||
List<string> results = new();
|
||||
string[] files;
|
||||
string message;
|
||||
List<string> allFiles;
|
||||
ProgressBar progressBar;
|
||||
List<(FileHolder, string)> toDoCollection;
|
||||
List<(FileHolder, string)> verifiedToDoCollection;
|
||||
List<string> allFiles = GetAllFiles(matchNginxCollection);
|
||||
allFiles = GetAllFiles(matchNginxCollection);
|
||||
ProgressBarOptions options = new() { ProgressCharacter = '─', ProgressBarOnBottom = true, DisableBottomPercentage = true };
|
||||
for (int i = 1; i < 3; i++)
|
||||
{
|
||||
if (!allFiles.Any())
|
||||
continue;
|
||||
message = $"{i}) Renaming files";
|
||||
if (_AppSettings.RenameUndo && i == 1)
|
||||
continue;
|
||||
files = i == 2 ? allFiles.ToArray() : (from l in allFiles where l.Contains("Rename") select l).ToArray();
|
||||
files = i == 2 ? allFiles.ToArray() : (from l in allFiles where l.Contains("Rename", StringComparison.OrdinalIgnoreCase) select l).ToArray();
|
||||
progressBar = new(files.Length, message, options);
|
||||
if (!files.Any())
|
||||
continue;
|
||||
@ -424,6 +442,7 @@ public class Rename
|
||||
results.AddRange(Move(log, toDoCollection));
|
||||
else
|
||||
results.AddRange(CopyInstead(log, toDoCollection));
|
||||
allFiles = GetAllFiles(matchNginxCollection);
|
||||
progressBar.Dispose();
|
||||
}
|
||||
return results;
|
||||
|
Reference in New Issue
Block a user