person-key-to-immich-import birthday json (Day-Helper-2024-05-18)
csharp_prefer_braces = true
This commit is contained in:
@ -1,6 +1,5 @@
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
namespace File_Folder_Helper.ADO2025.PI5;
|
||||
|
||||
@ -14,23 +13,25 @@ internal static partial class Helper20250301 {
|
||||
string sourceDirectory = Path.GetFullPath(args[0]);
|
||||
string workingDirectory = Path.GetFullPath(args[4]);
|
||||
string[] files = Directory.GetFiles(sourceDirectory, searchPattern, SearchOption.AllDirectories);
|
||||
if (files.Length == 0)
|
||||
if (files.Length == 0) {
|
||||
logger.LogWarning("<{files}>(s)", files.Length);
|
||||
else
|
||||
} else {
|
||||
PocketBaseImportWithDeno(logger, split, workingDirectory, scriptName, directory, files);
|
||||
}
|
||||
}
|
||||
|
||||
private static void PocketBaseImportWithDeno(ILogger<Worker> logger, char split, string workingDirectory, string scriptName, string directory, string[] files) {
|
||||
string checkFile = Path.Combine(workingDirectory, scriptName);
|
||||
if (!File.Exists(checkFile))
|
||||
if (!File.Exists(checkFile)) {
|
||||
logger.LogWarning("<{checkFile}> doesn't exist!", checkFile);
|
||||
else {
|
||||
} else {
|
||||
ReadOnlyCollection<string> fileNames = CopyFiles(split, workingDirectory, directory, files);
|
||||
if (fileNames.Count == 0)
|
||||
if (fileNames.Count == 0) {
|
||||
logger.LogWarning("<{fileNames}>(s)", fileNames.Count);
|
||||
else {
|
||||
foreach (string fileName in fileNames)
|
||||
} else {
|
||||
foreach (string fileName in fileNames) {
|
||||
logger.LogInformation("deno run --unstable --allow-read --allow-env --allow-net {scriptName} --id=true --input={fileName}", scriptName, fileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -40,13 +41,15 @@ internal static partial class Helper20250301 {
|
||||
string fileName;
|
||||
string checkFile;
|
||||
string checkDirectory = Path.Combine(workingDirectory, directory);
|
||||
if (!Directory.Exists(checkDirectory))
|
||||
if (!Directory.Exists(checkDirectory)) {
|
||||
_ = Directory.CreateDirectory(checkDirectory);
|
||||
}
|
||||
foreach (string file in files) {
|
||||
fileName = Path.GetFileName(file).Split(split)[^1];
|
||||
checkFile = Path.Combine(checkDirectory, fileName);
|
||||
if (File.Exists(checkFile))
|
||||
if (File.Exists(checkFile)) {
|
||||
File.Delete(checkFile);
|
||||
}
|
||||
File.Copy(file, checkFile);
|
||||
results.Add(fileName);
|
||||
}
|
||||
|
Reference in New Issue
Block a user