diff --git a/.idea/.idea.OneDriveArchiver/.idea/workspace.xml b/.idea/.idea.OneDriveArchiver/.idea/workspace.xml
index 475117c..c1996d8 100644
--- a/.idea/.idea.OneDriveArchiver/.idea/workspace.xml
+++ b/.idea/.idea.OneDriveArchiver/.idea/workspace.xml
@@ -23,291 +23,19 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
@@ -323,6 +51,18 @@
+
+
+
+
+
+
+
@@ -337,9 +77,9 @@
-
-
-
+
+
+
@@ -349,7 +89,7 @@
-
+
@@ -364,7 +104,7 @@
1597346163496
-
+
1597346544727
@@ -373,7 +113,14 @@
1597346544727
-
+
+ 1597388727683
+
+
+
+ 1597388727683
+
+
@@ -395,89 +142,98 @@
-
+
+
-
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
+
+
+
+
+
+
+
+
+
@@ -492,16 +248,29 @@
file://$PROJECT_DIR$/OneDriveArchiver/Program.cs
- 15
-
+ 19
+
-
+
-
+
-
+
+
+
+ file://$PROJECT_DIR$/OneDriveArchiver/Program.cs
+ 40
+
+
+
+
+
+
+
+
+
diff --git a/OneDriveArchiver/IoHelper.cs b/OneDriveArchiver/IoHelper.cs
index 8c47105..3173fe9 100644
--- a/OneDriveArchiver/IoHelper.cs
+++ b/OneDriveArchiver/IoHelper.cs
@@ -18,7 +18,7 @@ namespace OneDriveArchiver
///
///
/// Filename
- public static void ArchiveOneDriveFile(string appName, string filename)
+ public static void ArchiveOneDriveFile(string appName, string targetPath, string filename)
{
try
{
@@ -36,13 +36,12 @@ namespace OneDriveArchiver
var dateModified = File.GetLastWriteTime(filename);
var fileMonth = dateModified.Month.ToString("D2");
var fileYear = dateModified.Year.ToString();
- var basePath = Path.GetDirectoryName(filename);
var fileNameWithOutPath = Path.GetFileName(filename);
// check if we have to create either year or month folder...
// start with parent year folder...
- var fullYearFolderPath = Path.Combine(basePath ?? throw new InvalidOperationException(), fileYear);
- var fullMonthFolderPath = Path.Combine(Path.Combine(basePath, fileYear), fileMonth);
+ var fullYearFolderPath = Path.Combine(targetPath ?? throw new InvalidOperationException(), fileYear);
+ var fullMonthFolderPath = Path.Combine(Path.Combine(targetPath, fileYear), fileMonth);
// create the directories if not existing...
if (!Directory.Exists(fullYearFolderPath)) Directory.CreateDirectory(fullYearFolderPath);
@@ -57,8 +56,10 @@ namespace OneDriveArchiver
Console.WriteLine($"{appName}: archive file exists at designated folder. Removing the old file for copying the new one instead.");
File.Delete(newFullFileName);
}
+
// then move the file...
File.Move(filename, newFullFileName);
+ Console.WriteLine($"Moved onedrive file to {newFullFileName} successfully.");
}
catch (Exception ex)
{
diff --git a/OneDriveArchiver/Program.cs b/OneDriveArchiver/Program.cs
index 7ed9b33..dd961e8 100644
--- a/OneDriveArchiver/Program.cs
+++ b/OneDriveArchiver/Program.cs
@@ -12,25 +12,44 @@ namespace OneDriveArchiver
private static void Main(string[] args)
{
const string appName = "OneDriverArchiver";
-
- if (args.Length != 1)
+ var targetPath = string.Empty;
+
+ Console.WriteLine($"{appName} v.1.0");
+ Console.WriteLine("(c) 2020 JR IT Services");
+
+ if (args.Length < 1)
{
// handle improper arguments
Console.WriteLine(
- $"{appName}: Please specify a directory with files mapped to a Microsoft OneDrive folder.");
+ $"{appName}: Please call me with {appName} sourceDirectory [optional]targetDirectory.");
}
else
{
+ if (string.IsNullOrEmpty(args[0]))
+ {
+ Console.WriteLine("Please specify a source directory.");
+ }
+
// check if the directory to process really exists
if (!Directory.Exists(args[0]))
{
- Console.WriteLine($"{appName}: The directory '{args[0]}' does not exist. Please specify another one.");
+ Console.WriteLine($"{appName}: The source directory '{args[0]}' does not exist. Please specify an existing one.");
}
else
{
// normal processing...
Console.WriteLine($"{appName}: starting up...");
+ // set target path
+ if (args.Length == 1)
+ {
+ targetPath = Path.GetFullPath(".");
+ }
+ else
+ {
+ targetPath = args[1];
+ }
+
var startUpTime = DateTime.Now;
var filesToProcess = Directory.GetFiles(args[0]);
@@ -56,7 +75,7 @@ namespace OneDriveArchiver
}
// archive the file
- IoHelper.ArchiveOneDriveFile(appName, item);
+ IoHelper.ArchiveOneDriveFile(appName, targetPath,item);
Console.WriteLine($"{appName}: Processing for file {item} completed successfully.");
}
diff --git a/OneDriveArchiver/bin/Release/netcoreapp3.1/OneDriveArchiver.dll b/OneDriveArchiver/bin/Release/netcoreapp3.1/OneDriveArchiver.dll
index b081765..9e28ba8 100644
Binary files a/OneDriveArchiver/bin/Release/netcoreapp3.1/OneDriveArchiver.dll and b/OneDriveArchiver/bin/Release/netcoreapp3.1/OneDriveArchiver.dll differ
diff --git a/OneDriveArchiver/bin/Release/netcoreapp3.1/OneDriveArchiver.pdb b/OneDriveArchiver/bin/Release/netcoreapp3.1/OneDriveArchiver.pdb
index 626c7f3..e398a9f 100644
Binary files a/OneDriveArchiver/bin/Release/netcoreapp3.1/OneDriveArchiver.pdb and b/OneDriveArchiver/bin/Release/netcoreapp3.1/OneDriveArchiver.pdb differ
diff --git a/OneDriveArchiver/obj/OneDriveArchiver.csproj.nuget.dgspec.json b/OneDriveArchiver/obj/OneDriveArchiver.csproj.nuget.dgspec.json
index 16d290c..aa6a177 100644
--- a/OneDriveArchiver/obj/OneDriveArchiver.csproj.nuget.dgspec.json
+++ b/OneDriveArchiver/obj/OneDriveArchiver.csproj.nuget.dgspec.json
@@ -45,20 +45,6 @@
],
"assetTargetFallback": true,
"warn": true,
- "downloadDependencies": [
- {
- "name": "Microsoft.AspNetCore.App.Runtime.win-x64",
- "version": "[3.1.7, 3.1.7]"
- },
- {
- "name": "Microsoft.NETCore.App.Runtime.win-x64",
- "version": "[3.1.7, 3.1.7]"
- },
- {
- "name": "Microsoft.WindowsDesktop.App.Runtime.win-x64",
- "version": "[3.1.7, 3.1.7]"
- }
- ],
"frameworkReferences": {
"Microsoft.NETCore.App": {
"privateAssets": "all"
@@ -66,11 +52,6 @@
},
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\3.1.401\\RuntimeIdentifierGraph.json"
}
- },
- "runtimes": {
- "win-x64": {
- "#import": []
- }
}
}
}
diff --git a/OneDriveArchiver/obj/OneDriveArchiver.csproj.nuget.g.props b/OneDriveArchiver/obj/OneDriveArchiver.csproj.nuget.g.props
index 49b31c3..b5fb954 100644
--- a/OneDriveArchiver/obj/OneDriveArchiver.csproj.nuget.g.props
+++ b/OneDriveArchiver/obj/OneDriveArchiver.csproj.nuget.g.props
@@ -7,11 +7,8 @@
$(UserProfile)\.nuget\packages\
C:\Users\johan\.nuget\packages\
PackageReference
- 5.7.0
+ 5.5.0
-
-
-
$(MSBuildAllProjects);$(MSBuildThisFileFullPath)
diff --git a/OneDriveArchiver/obj/Release/netcoreapp3.1/OneDriveArchiver.csprojAssemblyReference.cache b/OneDriveArchiver/obj/Release/netcoreapp3.1/OneDriveArchiver.csprojAssemblyReference.cache
index 40d16df..9dad221 100644
Binary files a/OneDriveArchiver/obj/Release/netcoreapp3.1/OneDriveArchiver.csprojAssemblyReference.cache and b/OneDriveArchiver/obj/Release/netcoreapp3.1/OneDriveArchiver.csprojAssemblyReference.cache differ
diff --git a/OneDriveArchiver/obj/Release/netcoreapp3.1/OneDriveArchiver.dll b/OneDriveArchiver/obj/Release/netcoreapp3.1/OneDriveArchiver.dll
index b081765..9e28ba8 100644
Binary files a/OneDriveArchiver/obj/Release/netcoreapp3.1/OneDriveArchiver.dll and b/OneDriveArchiver/obj/Release/netcoreapp3.1/OneDriveArchiver.dll differ
diff --git a/OneDriveArchiver/obj/Release/netcoreapp3.1/OneDriveArchiver.pdb b/OneDriveArchiver/obj/Release/netcoreapp3.1/OneDriveArchiver.pdb
index 626c7f3..e398a9f 100644
Binary files a/OneDriveArchiver/obj/Release/netcoreapp3.1/OneDriveArchiver.pdb and b/OneDriveArchiver/obj/Release/netcoreapp3.1/OneDriveArchiver.pdb differ
diff --git a/OneDriveArchiver/obj/project.assets.json b/OneDriveArchiver/obj/project.assets.json
index 738e640..00af3b8 100644
--- a/OneDriveArchiver/obj/project.assets.json
+++ b/OneDriveArchiver/obj/project.assets.json
@@ -1,8 +1,7 @@
{
"version": 3,
"targets": {
- ".NETCoreApp,Version=v3.1": {},
- ".NETCoreApp,Version=v3.1/win-x64": {}
+ ".NETCoreApp,Version=v3.1": {}
},
"libraries": {},
"projectFileDependencyGroups": {
@@ -52,20 +51,6 @@
],
"assetTargetFallback": true,
"warn": true,
- "downloadDependencies": [
- {
- "name": "Microsoft.AspNetCore.App.Runtime.win-x64",
- "version": "[3.1.7, 3.1.7]"
- },
- {
- "name": "Microsoft.NETCore.App.Runtime.win-x64",
- "version": "[3.1.7, 3.1.7]"
- },
- {
- "name": "Microsoft.WindowsDesktop.App.Runtime.win-x64",
- "version": "[3.1.7, 3.1.7]"
- }
- ],
"frameworkReferences": {
"Microsoft.NETCore.App": {
"privateAssets": "all"
@@ -73,11 +58,6 @@
},
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\3.1.401\\RuntimeIdentifierGraph.json"
}
- },
- "runtimes": {
- "win-x64": {
- "#import": []
- }
}
}
}
\ No newline at end of file
diff --git a/OneDriveArchiver/obj/project.nuget.cache b/OneDriveArchiver/obj/project.nuget.cache
index 526029a..2356580 100644
--- a/OneDriveArchiver/obj/project.nuget.cache
+++ b/OneDriveArchiver/obj/project.nuget.cache
@@ -1,12 +1,8 @@
{
"version": 2,
- "dgSpecHash": "138W0tXEcg4vyZzmm0ngE67FUYyJmz4Gq9oY0SNEdYsE3cYuyqqgro97cunKtYN1Py1b03vmwmOtY6dFsNkKkg==",
+ "dgSpecHash": "Ndf2WK+JZuJJUSvyjFv/NuMjlE5m2nyqs51nC/CyW5fmiE8JzEz8wgkXv1pT4YggV34Kw16kDBMDQzOCSER4GA==",
"success": true,
"projectFilePath": "C:\\Users\\johan\\OneDrive\\DEV\\OneDriveArchiver\\OneDriveArchiver\\OneDriveArchiver.csproj",
- "expectedPackageFiles": [
- "C:\\Users\\johan\\.nuget\\packages\\microsoft.netcore.app.runtime.win-x64\\3.1.7\\microsoft.netcore.app.runtime.win-x64.3.1.7.nupkg.sha512",
- "C:\\Users\\johan\\.nuget\\packages\\microsoft.windowsdesktop.app.runtime.win-x64\\3.1.7\\microsoft.windowsdesktop.app.runtime.win-x64.3.1.7.nupkg.sha512",
- "C:\\Users\\johan\\.nuget\\packages\\microsoft.aspnetcore.app.runtime.win-x64\\3.1.7\\microsoft.aspnetcore.app.runtime.win-x64.3.1.7.nupkg.sha512"
- ],
+ "expectedPackageFiles": [],
"logs": []
}
\ No newline at end of file
diff --git a/OneDriveArchiver/obj/rider.project.restore.info b/OneDriveArchiver/obj/rider.project.restore.info
index cccca9d..b9be965 100644
--- a/OneDriveArchiver/obj/rider.project.restore.info
+++ b/OneDriveArchiver/obj/rider.project.restore.info
@@ -1 +1 @@
-15973464726152688
\ No newline at end of file
+15973993850524563
\ No newline at end of file