person-key-to-immich-import birthday json (Day-Helper-2024-05-18)
csharp_prefer_braces = true
This commit is contained in:
@ -13,19 +13,22 @@ internal static partial class Helper20241212 {
|
||||
string[] searchPatterns = args[3].Split('~');
|
||||
string sourceDirectory = Path.GetFullPath(args[0]);
|
||||
string[] files = Directory.GetFiles(sourceDirectory, searchPattern, SearchOption.AllDirectories);
|
||||
if (files.Length == 0)
|
||||
if (files.Length == 0) {
|
||||
logger.LogError("No files found in {sourceDirectory} with search pattern {searchPattern}", sourceDirectory, searchPattern);
|
||||
}
|
||||
foreach (string file in files) {
|
||||
fileName = Path.GetFileName(file);
|
||||
directoryName = Path.GetDirectoryName(file) ?? throw new Exception();
|
||||
newFileName = fileName;
|
||||
foreach (string pattern in searchPatterns)
|
||||
foreach (string pattern in searchPatterns) {
|
||||
newFileName = newFileName.Replace(pattern, "");
|
||||
}
|
||||
newFile = Path.Combine(directoryName, newFileName);
|
||||
if (File.Exists(newFile))
|
||||
if (File.Exists(newFile)) {
|
||||
logger.LogError("File {newFile} already exists", newFile);
|
||||
else
|
||||
} else {
|
||||
File.Move(file, newFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user