Rename all sub directories directories and
delete by distinct improvements
This commit is contained in:
parent
be8829bbcd
commit
fbaafe0137
32
.vscode/launch.json
vendored
32
.vscode/launch.json
vendored
@ -350,4 +350,34 @@
|
|||||||
// If not Hog and Original image size resize face
|
// If not Hog and Original image size resize face
|
||||||
// New json file with known locations at original image size
|
// New json file with known locations at original image size
|
||||||
// Add person to metadata when saving to SaveFilteredOriginalImagesFromJLinksForOutputResolutions maybe SaveMappedForOutputResolutions
|
// Add person to metadata when saving to SaveFilteredOriginalImagesFromJLinksForOutputResolutions maybe SaveMappedForOutputResolutions
|
||||||
// GetFaceLocations
|
// GetFaceLocations
|
||||||
|
// Stream stream;
|
||||||
|
// FileType fileType;
|
||||||
|
// const string abd = ".abd";
|
||||||
|
// List<string> jsonGroupFiles = GetFileCollection(jsonGroupFileCollection);
|
||||||
|
// foreach (string jsonGroupFile in jsonGroupFiles)
|
||||||
|
// File.Move(jsonGroupFile, string.Concat(jsonGroupFile, abd));
|
||||||
|
// stream = new FileStream(file, FileMode.Open, FileAccess.Read, FileShare.Read);
|
||||||
|
// fileType = FileTypeDetector.DetectFileType(stream);
|
||||||
|
// stream.Close();
|
||||||
|
// stream.Dispose();
|
||||||
|
// if (fileType == FileType.Unknown)
|
||||||
|
// continue;
|
||||||
|
// if (!isUniqueFileName || string.IsNullOrEmpty(resultAllInOneKey))
|
||||||
|
// {
|
||||||
|
// if (!isUniqueFileName && !string.IsNullOrEmpty(resultAllInOneKey))
|
||||||
|
// File.Move(Path.Combine(resultAllInOneKey, fileName), Path.Combine(resultAllInOneKey, $"{fileName}.del"));
|
||||||
|
// resultAllInOneKey = string.Concat(jsonGroupDirectory, directoryName[length..]);
|
||||||
|
// }
|
||||||
|
// if (!jsonGroupFileCollection.TryGetValue(resultAllInOneKey, out keyValuePairs) || !keyValuePairs.TryGetValue(fileName, out collection))
|
||||||
|
// fileAndJsonGroupFiles.Add(new FileAndJsonGroupFile(file, isUniqueFileName, Path.Combine(resultAllInOneKey, fileName), false));
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// foreach (string jsonGroupFile in collection)
|
||||||
|
// // File.Move(string.Concat(jsonGroupFile, abd), jsonGroupFile);
|
||||||
|
// fileAndJsonGroupFiles.Add(new FileAndJsonGroupFile(file, isUniqueFileName, jsonGroupFile, true));
|
||||||
|
// }
|
||||||
|
// C:\Program Files\ImageMagick-7.1.0-Q16-HDRI>identify -format '%Q' "D:\7) Question\- - - Images\Mike Goolgle Photos 2014\-1507651551.jpg"
|
||||||
|
// '98'
|
||||||
|
// C:\Program Files\ImageMagick-7.1.0-Q16-HDRI>identify -format '%Q' "D:\7) Question\- - - Images\Mike Goolgle Photos 2014\197616258.jpg"
|
||||||
|
// '90'
|
@ -34,11 +34,12 @@ public class DeleteByDistinct
|
|||||||
private static void Work(AppSettings appSettings, long ticks, ILogger log, string directory, string variable, ProgressBarOptions options, Dictionary<long, Dictionary<long, List<string>>> fileSizeToCollection, bool logOnly)
|
private static void Work(AppSettings appSettings, long ticks, ILogger log, string directory, string variable, ProgressBarOptions options, Dictionary<long, Dictionary<long, List<string>>> fileSizeToCollection, bool logOnly)
|
||||||
{
|
{
|
||||||
string message;
|
string message;
|
||||||
|
long checkTicks;
|
||||||
|
long checkLength;
|
||||||
string checkName;
|
string checkName;
|
||||||
string deleteLog;
|
string deleteLog;
|
||||||
int totalSeconds;
|
int totalSeconds;
|
||||||
FileInfo fileInfo;
|
FileInfo fileInfo;
|
||||||
DateTime checkDate;
|
|
||||||
ProgressBar progressBar;
|
ProgressBar progressBar;
|
||||||
List<string>? fileNames;
|
List<string>? fileNames;
|
||||||
ConsoleKey? consoleKey = null;
|
ConsoleKey? consoleKey = null;
|
||||||
@ -55,13 +56,18 @@ public class DeleteByDistinct
|
|||||||
progressBar.Tick();
|
progressBar.Tick();
|
||||||
foreach (string file in files)
|
foreach (string file in files)
|
||||||
{
|
{
|
||||||
|
if (file.EndsWith(".id") || file.Contains("Rename"))
|
||||||
|
continue;
|
||||||
fileInfo = new(file);
|
fileInfo = new(file);
|
||||||
if (fileInfo.Length < 100)
|
if (fileInfo.Length < 100)
|
||||||
continue;
|
continue;
|
||||||
if (!fileSizeToCollection.TryGetValue(fileInfo.Length, out fileTicksToNames))
|
checkLength = fileInfo.Length;
|
||||||
|
// checkLength = (long)Math.Round((double)(fileInfo.Length / 1000));
|
||||||
|
// checkLength = 1;
|
||||||
|
if (!fileSizeToCollection.TryGetValue(checkLength, out fileTicksToNames))
|
||||||
{
|
{
|
||||||
fileSizeToCollection.Add(fileInfo.Length, new());
|
fileSizeToCollection.Add(checkLength, new());
|
||||||
if (!fileSizeToCollection.TryGetValue(fileInfo.Length, out fileTicksToNames))
|
if (!fileSizeToCollection.TryGetValue(checkLength, out fileTicksToNames))
|
||||||
throw new Exception();
|
throw new Exception();
|
||||||
}
|
}
|
||||||
// if (!fileTicksToNames.TryGetValue(fileInfo.LastWriteTime.Ticks, out fileNames))
|
// if (!fileTicksToNames.TryGetValue(fileInfo.LastWriteTime.Ticks, out fileNames))
|
||||||
@ -70,16 +76,17 @@ public class DeleteByDistinct
|
|||||||
// if (!fileTicksToNames.TryGetValue(fileInfo.LastWriteTime.Ticks, out fileNames))
|
// if (!fileTicksToNames.TryGetValue(fileInfo.LastWriteTime.Ticks, out fileNames))
|
||||||
// throw new Exception();
|
// throw new Exception();
|
||||||
// }
|
// }
|
||||||
// checkDate = new DateTime(ticks);
|
checkTicks = new DateTime(ticks).Ticks;
|
||||||
checkDate = new DateTime(fileInfo.LastWriteTime.Year, fileInfo.LastWriteTime.Month, fileInfo.LastWriteTime.Day);
|
// checkTicks = new DateTime(fileInfo.LastWriteTime.Year, fileInfo.LastWriteTime.Month, fileInfo.LastWriteTime.Day).Ticks;
|
||||||
if (!fileTicksToNames.TryGetValue(checkDate.Ticks, out fileNames))
|
// checkTicks = 1;
|
||||||
|
if (!fileTicksToNames.TryGetValue(checkTicks, out fileNames))
|
||||||
{
|
{
|
||||||
fileTicksToNames.Add(checkDate.Ticks, new());
|
fileTicksToNames.Add(checkTicks, new());
|
||||||
if (!fileTicksToNames.TryGetValue(checkDate.Ticks, out fileNames))
|
if (!fileTicksToNames.TryGetValue(checkTicks, out fileNames))
|
||||||
throw new Exception();
|
throw new Exception();
|
||||||
}
|
}
|
||||||
checkName = fileInfo.Name[..10];
|
// checkName = fileInfo.Name[..10];
|
||||||
// checkName = fileInfo.Name.ToLower().Replace(".jpeg", ".jpg");
|
checkName = fileInfo.Name.ToLower().Replace(".jpeg", ".jpg");
|
||||||
if (fileNames.Contains(checkName))
|
if (fileNames.Contains(checkName))
|
||||||
deletedFiles.Add(file);
|
deletedFiles.Add(file);
|
||||||
else
|
else
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"CompareRootDirectory": "D:/7) Question/- - - Videos A",
|
"CompareRootDirectory": "D:/7) Question/- - - Images",
|
||||||
"Logging": {
|
"Logging": {
|
||||||
"LogLevel": {
|
"LogLevel": {
|
||||||
"Log4netProvider": "Debug"
|
"Log4netProvider": "Debug"
|
||||||
@ -14,8 +14,8 @@
|
|||||||
"Configuration": {
|
"Configuration": {
|
||||||
"xRootDirectory": "D:/2) Images B/Corrupt",
|
"xRootDirectory": "D:/2) Images B/Corrupt",
|
||||||
"xxRootDirectory": "D:/2) Images B/Not-Copy-Copy-45f4401",
|
"xxRootDirectory": "D:/2) Images B/Not-Copy-Copy-45f4401",
|
||||||
"xxxRootDirectory": "D:/1) Images A/Images-45f4401",
|
"RootDirectory": "D:/1) Images A/Images-45f4401",
|
||||||
"RootDirectory": "E:/3) Videos A/Device Videos 2_0_0_3 - Current",
|
"xxxxRootDirectory": "E:/3) Videos A/Device Videos 2_0_0_3 - Current",
|
||||||
"xxxxxRootDirectory": "E:/4) Videos B/Device Videos 2_0_0_3 - Current - Ignore",
|
"xxxxxRootDirectory": "E:/4) Videos B/Device Videos 2_0_0_3 - Current - Ignore",
|
||||||
"VerifyToSeason": []
|
"VerifyToSeason": []
|
||||||
}
|
}
|
||||||
|
@ -19,8 +19,8 @@
|
|||||||
"xPersonCharactersCopyCount": 2,
|
"xPersonCharactersCopyCount": 2,
|
||||||
"xRootDirectory": "D:/Tmp/phares/Pictures",
|
"xRootDirectory": "D:/Tmp/phares/Pictures",
|
||||||
"xxRootDirectory": "D:/Tmp/Phares/Compare/Corrupt",
|
"xxRootDirectory": "D:/Tmp/Phares/Compare/Corrupt",
|
||||||
"RootDirectory": "D:/2) Images B/Not-Copy-Copy-45f4401",
|
"xxxRootDirectory": "D:/2) Images B/Not-Copy-Copy-45f4401",
|
||||||
"xxxxRootDirectory": "D:/1) Images A/Images-45f4401",
|
"RootDirectory": "D:/1) Images A/Images-45f4401",
|
||||||
"xxxxxRootDirectory": "D:/1) Images A/Images-45f4401/Facebook/=2022.3 Facebook",
|
"xxxxxRootDirectory": "D:/1) Images A/Images-45f4401/Facebook/=2022.3 Facebook",
|
||||||
"SaveSortingWithoutPerson": true,
|
"SaveSortingWithoutPerson": true,
|
||||||
"JLinks": [
|
"JLinks": [
|
||||||
@ -38,12 +38,12 @@
|
|||||||
"PropertyContentCollectionFiles": [],
|
"PropertyContentCollectionFiles": [],
|
||||||
"RangeDaysDeltaTolerance": [
|
"RangeDaysDeltaTolerance": [
|
||||||
0,
|
0,
|
||||||
2100,
|
4100,
|
||||||
123456
|
123456
|
||||||
],
|
],
|
||||||
"RangeDistanceTolerance": [
|
"RangeDistanceTolerance": [
|
||||||
0,
|
0,
|
||||||
0.3,
|
0.6,
|
||||||
0.6
|
0.6
|
||||||
],
|
],
|
||||||
"RangeFaceAreaPermilleTolerance": [
|
"RangeFaceAreaPermilleTolerance": [
|
||||||
|
@ -232,7 +232,7 @@ public class Rename
|
|||||||
continue;
|
continue;
|
||||||
if (File.Exists(matchNginx.ConvertedPath))
|
if (File.Exists(matchNginx.ConvertedPath))
|
||||||
continue;
|
continue;
|
||||||
files = Directory.GetFiles(matchNginx.ConvertedPath, "*", SearchOption.TopDirectoryOnly);
|
files = Directory.GetFiles(matchNginx.ConvertedPath, "*", SearchOption.AllDirectories);
|
||||||
if (files.All(l => l.EndsWith(".id")))
|
if (files.All(l => l.EndsWith(".id")))
|
||||||
{
|
{
|
||||||
foreach (string file in files)
|
foreach (string file in files)
|
||||||
@ -258,6 +258,8 @@ public class Rename
|
|||||||
message = $"{i}) Renaming files";
|
message = $"{i}) Renaming files";
|
||||||
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") select l).ToArray();
|
||||||
progressBar = new(files.Length, message, options);
|
progressBar = new(files.Length, message, options);
|
||||||
|
if (!files.Any())
|
||||||
|
continue;
|
||||||
(renameCollection, distinctCount) = RenameFilesInDirectory(progressBar, files);
|
(renameCollection, distinctCount) = RenameFilesInDirectory(progressBar, files);
|
||||||
foreach ((FileHolder fileHolder, string to) in renameCollection)
|
foreach ((FileHolder fileHolder, string to) in renameCollection)
|
||||||
{
|
{
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"ComparePathsFile": "C:/Users/mikep/AppData/Local/PharesApps/Drag-Drop-Explorer/2023_01/638082668201867717.json",
|
"ComparePathsFile": "C:/Users/mikep/AppData/Local/PharesApps/Drag-Drop-Explorer/2023_02/638089737585839769.json",
|
||||||
"Logging": {
|
"Logging": {
|
||||||
"LogLevel": {
|
"LogLevel": {
|
||||||
"Log4netProvider": "Debug"
|
"Log4netProvider": "Debug"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user