Start of ;9
This commit is contained in:
parent
e6acce3852
commit
1e85c0ba2e
@ -108,7 +108,9 @@ internal abstract partial class XDirectory
|
||||
if (possibleFileInfo.LastWriteTime == fileInfo.LastWriteTime && possibleFileInfo.Length == fileInfo.Length)
|
||||
continue;
|
||||
timeSpan = new(possibleFileInfo.LastWriteTime.Ticks - fileInfo.LastWriteTime.Ticks);
|
||||
if (timeSpan.TotalMinutes < 2 && possibleFileInfo.Length == fileInfo.Length)
|
||||
if (possibleFileInfo.Length != fileInfo.Length)
|
||||
throw new Exception(Path.GetFileNameWithoutExtension(file));
|
||||
if (timeSpan.TotalMinutes < 61)
|
||||
{
|
||||
File.SetLastWriteTime(file, new DateTime[] { possibleFileInfo.LastWriteTime, fileInfo.LastWriteTime }.Min());
|
||||
continue;
|
||||
@ -134,7 +136,7 @@ internal abstract partial class XDirectory
|
||||
continue;
|
||||
matches.Add(possible);
|
||||
}
|
||||
if (matches.Count == 1 || (lengths.Distinct().Count() == 1 && creationTimes.Distinct().Count() == 1))
|
||||
if (matches.Count == 1 || (matches.Any() && lengths.Distinct().Count() == 1 && creationTimes.Distinct().Count() == 1))
|
||||
result = matches.First();
|
||||
return result;
|
||||
}
|
||||
|
@ -755,7 +755,21 @@ public partial class UnitTestHardCoded
|
||||
foreach (string sex in new string[] { "Unknown", "Male", "Female" })
|
||||
_ = Directory.CreateDirectory($"D:/{status}-{sex}");
|
||||
}
|
||||
NonThrowTryCatch();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TestMethodRename()
|
||||
{
|
||||
// string[] directories = Directory.GetDirectories(@"D:\2) Images B\Not-Copy-Copy-9b89679", "*;*", SearchOption.AllDirectories);
|
||||
// string[] directories = Directory.GetDirectories(@"D:\1) Images A\Images-9b89679", "*;*", SearchOption.AllDirectories);
|
||||
string[] directories = Directory.GetDirectories(@"D:\2) Images B\Not-Copy-Copy-9b89679", "*", SearchOption.AllDirectories);
|
||||
foreach (string directory in directories.OrderByDescending(l => l.Length - l.Replace(@"\", string.Empty).Length))
|
||||
{
|
||||
if (directory.EndsWith(";9"))
|
||||
continue;
|
||||
Directory.Move(directory, $"{directory};9");
|
||||
}
|
||||
NonThrowTryCatch();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user