Added code to find any files that have been moved, basic but for the time being it seems to work well enough.
This commit is contained in:
@@ -3,6 +3,7 @@ using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
|
||||
@@ -256,7 +257,7 @@ namespace DataOrganizer
|
||||
};
|
||||
}
|
||||
|
||||
public List<SnapshotComparsion.RenamedFile> FindFileRenames(Folder a, Folder b)
|
||||
public static List<SnapshotComparsion.RenamedFile> FindFileRenames(Folder a, Folder b)
|
||||
{
|
||||
var renames = new List<SnapshotComparsion.RenamedFile>();
|
||||
|
||||
@@ -275,11 +276,34 @@ namespace DataOrganizer
|
||||
return renames;
|
||||
}
|
||||
|
||||
public List<Duplicate> FindDuplicates(Folder topLevelFolder)
|
||||
public static List<SnapshotComparsion.RenamedFile> FindFileMoves(Folder a, Folder b)
|
||||
{
|
||||
var files = new List<SnapshotComparsion.RenamedFile>();
|
||||
var filesA = a.GetAllFiles();
|
||||
var filesB = b.GetAllFiles();
|
||||
|
||||
foreach(var fileA in filesA)
|
||||
{
|
||||
foreach(var fileB in filesB)
|
||||
{
|
||||
if(fileB.CreatedDate == fileA.CreatedDate && fileA.ModifiedDate == fileB.ModifiedDate && fileA.Size == fileB.Size)
|
||||
{
|
||||
files.Add(new SnapshotComparsion.RenamedFile { From = fileA, To = fileB });
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return files;
|
||||
}
|
||||
|
||||
public static List<Duplicate> FindDuplicates(Folder topLevelFolder)
|
||||
{
|
||||
var duplicates = new Dictionary<string, Duplicate>();
|
||||
var files = topLevelFolder.GetAllFiles();
|
||||
var fileCount = 0;
|
||||
var seasonFolderName = new Regex(@"^(?i)season\W+\d+");
|
||||
var extrasFolderName = new Regex(@"^(?i)(?:extras|specials|movies)+$");
|
||||
|
||||
fileCount = files.Count;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user