Compare commits

...

1 Commits

Author SHA1 Message Date
8fc4fdb849 created-date-offset (Day-Helper-2025-08-03)
P and J drives
2025-08-03 13:39:51 -07:00
4 changed files with 75 additions and 17 deletions

20
.vscode/launch.json vendored
View File

@ -8,19 +8,27 @@
"name": ".NET Core Launch (console)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"preLaunchTask": "Build",
"program": "${workspaceFolder}/bin/Debug/net8.0/win-x64/File-Folder-Helper.dll",
"args": [
"s",
"X",
"V:/7-Question/Event 2024 Directories-xmp",
"P:/7-Question/Scanned Pictures II-a",
"Day-Helper-2025-08-03",
"*.tif",
"100",
"Years",
"P:/7-Question/Scanned Pictures II-c",
"s",
"X",
"P:/7-Question/Event 2024 Directories-xmp",
"Day-Helper-2025-07-26",
"L:/Git/AA/Rename/.vscode/.UserSecrets/secrets.json",
"*.xmp",
"V:/7-Question/Event 2024 Directories-xmp-moved",
"P:/7-Question/Event 2024 Directories-xmp-moved",
"s",
"X",
"V:/1-Images-A/Images-0b793904",
"P:/1-Images-A/Images-0b793904",
"Day-Helper-2024-12-17",
".job.json",
"thumbs.db~sync.ffs_db~verify.json~.html",
@ -28,7 +36,7 @@
"D:/5-Other-Small/Disk/Snap2HTML/Snap2HTML.exe",
"s",
"X",
"V:/Tmp/Phares/Helper-2025-07-20",
"P:/Tmp/Phares/Helper-2025-07-20",
"Day-Helper-2025-07-20",
"871467010009.jpg",
"L:/Git/AA/Rename/.vscode/.UserSecrets/secrets.json",
@ -74,7 +82,7 @@
"\"vp154\"",
"s",
"X",
"V:/Tmp/Phares/Pictures/2023 TI2023.6 Fall Samsung",
"P:/Tmp/Phares/Pictures/2023 TI2023.6 Fall Samsung",
"Day-Helper-2025-07-05",
"x-653889110721.jpg~401223300869.jpg",
"3648,2736,1~3024,4032,6",

22
.vscode/tasks.json vendored
View File

@ -43,7 +43,7 @@
"problemMatcher": "$msCompile"
},
{
"label": "Format-Whitespaces",
"label": "Format Whitespaces",
"command": "dotnet",
"type": "process",
"args": [
@ -53,7 +53,7 @@
"problemMatcher": "$msCompile"
},
{
"label": "build",
"label": "Build",
"command": "dotnet",
"type": "process",
"args": [
@ -67,7 +67,7 @@
"problemMatcher": "$msCompile"
},
{
"label": "build Linux",
"label": "Build Linux",
"command": "dotnet",
"type": "process",
"args": [
@ -81,7 +81,7 @@
"problemMatcher": "$msCompile"
},
{
"label": "podmanLogin",
"label": "Podman Login",
"command": "podman",
"type": "process",
"args": [
@ -91,7 +91,7 @@
"problemMatcher": "$msCompile"
},
{
"label": "podmanBuild",
"label": "Podman Build",
"command": "podman",
"type": "process",
"args": [
@ -103,7 +103,7 @@
"problemMatcher": "$msCompile"
},
{
"label": "podmanImageList",
"label": "Podman Image List",
"command": "podman",
"type": "process",
"args": [
@ -113,7 +113,7 @@
"problemMatcher": "$msCompile"
},
{
"label": "podmanRun",
"label": "Podman Run",
"command": "podman",
"type": "process",
"args": [
@ -127,7 +127,7 @@
"problemMatcher": "$msCompile"
},
{
"label": "podmanTag",
"label": "Podman Tag",
"command": "podman",
"type": "process",
"args": [
@ -138,7 +138,7 @@
"problemMatcher": "$msCompile"
},
{
"label": "podmanPush",
"label": "Podman Push",
"command": "podman",
"type": "process",
"args": [
@ -148,7 +148,7 @@
"problemMatcher": "$msCompile"
},
{
"label": "publish",
"label": "Publish",
"command": "dotnet",
"type": "process",
"args": [
@ -160,7 +160,7 @@
"problemMatcher": "$msCompile"
},
{
"label": "watch",
"label": "Watch",
"command": "dotnet",
"type": "process",
"args": [

View File

@ -0,0 +1,48 @@
using Microsoft.Extensions.Logging;
namespace File_Folder_Helper.ADO2025.PI6;
internal static partial class Helper20250803 {
internal static void CreatedDateOffset(ILogger<Worker> logger, List<string> args) {
logger.LogInformation(args[0]);
logger.LogInformation(args[1]);
logger.LogInformation(args[2]);
logger.LogInformation(args[3]);
logger.LogInformation(args[4]);
logger.LogInformation(args[5]);
int years = int.Parse(args[3]) * -1;
if (args[4] != "Years") {
throw new NotImplementedException($"{args[4]} != Days");
}
string checkFile;
FileInfo fileInfo;
DateTime dateTime;
string searchPattern = args[2];
string fileNameWithoutExtension;
string fileNameWithoutExtensionOut;
string sourceDirectory = Path.GetFullPath(args[0].Split('~')[0]);
string destinationDirectory = Path.GetFullPath(args[5].Split('~')[0]);
if (!Directory.Exists(destinationDirectory)) {
_ = Directory.CreateDirectory(destinationDirectory);
}
string[] files = Directory.GetFiles(sourceDirectory, searchPattern, SearchOption.AllDirectories);
foreach (string file in files) {
fileInfo = new(file);
fileNameWithoutExtension = Path.GetFileNameWithoutExtension(fileInfo.FullName);
fileNameWithoutExtensionOut = fileNameWithoutExtension[^1] == '9' ?
$"{fileNameWithoutExtension[..^1]}7" :
fileNameWithoutExtension[^1] == '1' ?
$"{fileNameWithoutExtension[..^1]}3" :
fileNameWithoutExtension;
checkFile = Path.Combine(destinationDirectory, $"{fileNameWithoutExtensionOut}{fileInfo.Extension}");
if (File.Exists(checkFile)) {
logger.LogWarning("<{file}> already exists!", checkFile);
continue;
}
File.Copy(file, checkFile);
dateTime = new DateTime(fileInfo.LastWriteTime.Year + years, fileInfo.LastWriteTime.Month, fileInfo.LastWriteTime.Day, fileInfo.LastWriteTime.Hour, fileInfo.LastWriteTime.Minute, fileInfo.LastWriteTime.Second);
File.SetCreationTime(checkFile, dateTime);
}
}
}

View File

@ -185,6 +185,8 @@ internal static class HelperDay
ADO2025.PI6.Helper20250720.WriteFaceData(logger, args);
else if (args[1] == "Day-Helper-2025-07-26")
ADO2025.PI6.Helper20250726.CopyToCombinedEnumAndIndexFormat(logger, args);
else if (args[1] == "Day-Helper-2025-08-03")
ADO2025.PI6.Helper20250803.CreatedDateOffset(logger, args);
else
throw new Exception(appSettings.Company);
}