Update Namespaces

This commit is contained in:
2024-08-09 09:54:22 -07:00
parent a0699ef634
commit 29bec0cb9a
38 changed files with 74 additions and 74 deletions

View File

@ -0,0 +1,37 @@
using Microsoft.Extensions.Logging;
namespace File_Folder_Helper.Day.Q42023;
internal static class Helper20231108
{
internal static void MasterImage(ILogger<Worker> logger, List<string> args)
{
string fileName;
string checkFile;
string[] aSegments;
string[] bSegments;
if (!Directory.Exists(args[0]))
throw new Exception(args[0]);
if (!Directory.Exists(args[2]))
throw new Exception(args[2]);
string directoryName = Path.GetFileName(args[0]) ?? throw new Exception();
string[] files = Directory.GetFiles(args[0]);
logger.LogInformation("{fileCount}", files.Length.ToString());
foreach (string file in files)
{
aSegments = Path.GetFileNameWithoutExtension(file).Split('-');
if (aSegments.Length != 2)
continue;
bSegments = aSegments[1].Split('_');
if (bSegments.Length != 3)
continue;
fileName = $"{directoryName}-{bSegments[1]}-{bSegments[0]}{Path.GetExtension(file)}";
checkFile = Path.Combine(args[2], fileName);
if (File.Exists(checkFile))
continue;
File.Copy(file, checkFile);
}
}
}