From 289a972be9d686991d397005c22370013bf690b5 Mon Sep 17 00:00:00 2001 From: Akutra-Ramses Atenosis Cea Date: Mon, 17 May 2021 23:57:19 -0700 Subject: [PATCH 1/6] Updated to version 1.4.4 - added option to copy files only - added option to exclude files or folders --- hypersync/Program.cs | 11 ++++++++++- hypersync/Properties/AssemblyInfo.cs | 4 ++-- hypersync/SyncCopy.cs | 19 ++++++++++++++++--- hypersync/hypersync.csproj | 4 ++-- hypersync/syncconfig.cs | 2 ++ 5 files changed, 32 insertions(+), 8 deletions(-) diff --git a/hypersync/Program.cs b/hypersync/Program.cs index 0be57f8..9f3940c 100644 --- a/hypersync/Program.cs +++ b/hypersync/Program.cs @@ -9,6 +9,7 @@ static class Program { static DisplayManager OutputManager = new DisplayManager(); static configLoader ConfigManager = new configLoader(OutputManager); + static List UserExcludes = new List(); static bool SaveAndExit = false; /// @@ -60,6 +61,7 @@ static void Main(string[] args) SyncCopy Synchronizer = new SyncCopy(ConfigManager, OutputManager); Synchronizer.SourcePath = ConfigManager.ConfigData.SyncPaths[0].src_folder; Synchronizer.DestPath = ConfigManager.ConfigData.SyncPaths[0].dest_folder; + Synchronizer.UserExclusion = UserExcludes; Synchronizer.CopyFolder(); string final_notice = string.Format("> Synchronization Completed at {0}\n\r", DateTime.Now); @@ -120,6 +122,9 @@ static void ProcessArgument(string argument, int apos) case "damaged": ConfigManager.ConfigData.DamagedSource = true; break; + case "nofolders": + ConfigManager.ConfigData.nofolders = true; + break; case "src": case "s": AddSrc(parm); @@ -143,12 +148,16 @@ static void ProcessArgument(string argument, int apos) OutputManager.AppendToConsole(" [type="); OutputManager.AppendToConsole("", ConsoleColor.White); OutputManager.AppendToConsole("]"); OutputManager.AppendToConsole(" [log="); OutputManager.AppendToConsole("", ConsoleColor.White); OutputManager.AppendToConsole("]"); OutputManager.AppendToConsole(" [loglevel="); OutputManager.AppendToConsole("", ConsoleColor.White); OutputManager.AppendToConsole("]"); - OutputManager.AppendLineToConsole(" [KeepNewerDest] [damaged] [v or version] [h or help] [w]"); + OutputManager.AppendToConsole(" [x="); OutputManager.AppendToConsole("", ConsoleColor.White); OutputManager.AppendToConsole("]"); + OutputManager.AppendLineToConsole(" [KeepNewerDest] [damaged] [v or version] [h or help] [w] [nofolders]"); System.Environment.Exit(0); break; case "w": SaveAndExit = true; break; + case "x": + UserExcludes.Add(parm); + break; default: // No field name specified if(apos==1) { AddSrc(argument); } diff --git a/hypersync/Properties/AssemblyInfo.cs b/hypersync/Properties/AssemblyInfo.cs index f1d3ec8..8208a8b 100644 --- a/hypersync/Properties/AssemblyInfo.cs +++ b/hypersync/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.4.3.6")] -[assembly: AssemblyFileVersion("1.4.3.6")] +[assembly: AssemblyVersion("1.4.4.1")] +[assembly: AssemblyFileVersion("1.4.4.1")] diff --git a/hypersync/SyncCopy.cs b/hypersync/SyncCopy.cs index 890a5b6..120d395 100644 --- a/hypersync/SyncCopy.cs +++ b/hypersync/SyncCopy.cs @@ -11,6 +11,7 @@ namespace hypersync public class SyncCopy { public reportdata result_data = new reportdata(); + public List UserExclusion = new List(); private DisplayManager ScreenPrinter; private configLoader configHandler { get; set; } @@ -157,7 +158,7 @@ public void CopyFolder(string SourceFolder = "") result_data.total_missingdest++; } - if (copyCurFile) + if (copyCurFile && !ToExcludeFile(cFile) ) { if (!AnalyzeOnly) { @@ -185,12 +186,24 @@ public void CopyFolder(string SourceFolder = "") } // Copy the subfolders - if (!StopCopy) + if (StopCopy == false && configHandler.ConfigData.nofolders == false) { ScanFolders(SourceFolder); } } + private bool ToExcludeFile(string full_path) + { + var finds = this.UserExclusion.Where(p => (!p.EndsWith(this.folder_delimiter.ToString()) && p == full_path)); + return finds.Count() > 0; + } + + private bool ToExcludeFolder(string full_path) + { + var finds = this.UserExclusion.Where(p => (p.EndsWith(this.folder_delimiter.ToString()) && p.Trim(this.folder_delimiter) == full_path)); + return finds.Count() > 0; + } + private void ScanFolders(string SourceFolder) { string[] SourceFolders; @@ -200,7 +213,7 @@ private void ScanFolders(string SourceFolder) SourceFolders = Directory.GetDirectories(SourceFolder); foreach (string cFolder in SourceFolders) { - if (!exclusionCheck(cFolder)) + if (!exclusionCheck(cFolder) && !ToExcludeFolder(cFolder)) { tsrc = cFolder; diff --git a/hypersync/hypersync.csproj b/hypersync/hypersync.csproj index 007f5e4..a9fd547 100644 --- a/hypersync/hypersync.csproj +++ b/hypersync/hypersync.csproj @@ -29,8 +29,8 @@ Hypersync Akutra Ramses Atenosis Cea Hyperconnect - 6 - 1.4.3.%2a + 1 + 1.4.4.%2a false true diff --git a/hypersync/syncconfig.cs b/hypersync/syncconfig.cs index a2f7528..ec806f0 100644 --- a/hypersync/syncconfig.cs +++ b/hypersync/syncconfig.cs @@ -15,6 +15,7 @@ public class syncconfig public bool Migratory { get; set; } public bool KeepNewerDest { get; set; } public bool DamagedSource { get; set; } + public bool nofolders { get; set; } public string LogFile { get; set; } public FolderPath[] SyncPaths; @@ -27,6 +28,7 @@ public syncconfig() this.LogLevel = 3; // default log file this.LogFile = "synclog.txt"; + this.nofolders = false; } } From 728562d71d5183ae82bd41f8794920dc7658e8a8 Mon Sep 17 00:00:00 2001 From: Akutra-Ramses Atenosis Cea Date: Tue, 18 May 2021 00:52:50 -0700 Subject: [PATCH 2/6] Update README.md --- README.md | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 72 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 8c7325e..3f708a3 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,73 @@ # hypersync -Folder and file synchronizer. Update folders with only newer files. Easily maintain duplicate or migrated data. + +[![Documentation Status]]TBD +[![Translation Status]]TBD +[![Linux Build Status]]Successful +[![macOS Build Status]]TBD +[![Windows Build Status]]Success +[![Coverage Status]]TBD + +Folder and file synchronizer. + +- [Downloads](https://github.com/Akutra/hypersync-console/releases) +- [Web Site](https://github.com/Akutra/hypersync-console) +- [Documentation]() +- [Bug Reports](https://github.com/Akutra/hypersync-console/issues) +- [Donate]() + +## Overview + +HyperSync Update folders with only newer files. Easily maintain duplicate or migrated data. + +## Features + +* Support for Windows and Linux +* Easily specify files and folders as source/destination +* Retain setting in an XML file to reuse later +* Three level of logs +* Exclude files or folders +* Specifiy Damaged source to skip failed/damaged files + +## Install + +To install Hypersync, copy the binary to you Windows path or bin folder. + +### Windows + +Place the binary in any folder you desire to access it from such as a path located in your %path% folder. + +#### Linux (e.g. Ubuntu) + +Plase the binary in any folder you desire to access it from such as /usr/local/bin. + +## Using the App + +Execute the command "Hypersync v" to verify it is installed. If present it will output the installed version. + +## Build from Source Code + +To build the application from source code, install Visual Studio (Windows) or MonoDevelop (Linux). + +- [Git](https://git-scm.com/) +- Visual Studio or MonoDevelop +- .NET 4.8 (Visual Studio) + + +### Build the App + +Change install prefix if needed: + +```bash +git clone https://github.com/Akutra/hypersync-console.git +cd hypersync +``` + +You can now run the built app. + +```bash +hypersync v +``` + +## Contributions + +To Be Determined. From 3b0035b88d70f08588e1e4719db90a77a1f691b9 Mon Sep 17 00:00:00 2001 From: Akutra-Ramses Atenosis Cea Date: Tue, 18 May 2021 01:17:12 -0700 Subject: [PATCH 3/6] Move exclusion list to constants --- hypersync/Constants.cs | 3 ++- hypersync/SyncCopy.cs | 10 ++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/hypersync/Constants.cs b/hypersync/Constants.cs index 5612d98..aa0fba3 100644 --- a/hypersync/Constants.cs +++ b/hypersync/Constants.cs @@ -8,6 +8,7 @@ namespace hypersync { public static partial class Constants { - + public static string[] exclusionList = { "$RECYCLE.BIN", "System Volume Information", "WindowsImageBackup", "RECYCLER" }; + public static string[] exclusionFileList = { "container.dat", "Thumbs.db", "Desktop.ini", "~$" }; } } diff --git a/hypersync/SyncCopy.cs b/hypersync/SyncCopy.cs index 120d395..a42f38b 100644 --- a/hypersync/SyncCopy.cs +++ b/hypersync/SyncCopy.cs @@ -15,8 +15,6 @@ public class SyncCopy private DisplayManager ScreenPrinter; private configLoader configHandler { get; set; } - string[] exclusionList = { "$RECYCLE.BIN", "System Volume Information", "WindowsImageBackup", "RECYCLER" }; - string[] exclusionFileList = { "container.dat", "Thumbs.db", "Desktop.ini", "~$" }; private bool StopCopy = false, skipFile = false, AnalyzeOnly = false; public string DestPath = ""; public string SourcePath = ""; @@ -369,9 +367,9 @@ bool exclusionCheck(string file) { bool rt = false; - for (int x=0; x < exclusionList.Length; x++) // Fastest loop mechanizm for this repetative task + for (int x=0; x < Constants.exclusionList.Length; x++) // Fastest loop mechanizm for this repetative task { - if (file.Contains(exclusionList[x])) + if (file.Contains(Constants.exclusionList[x])) { rt = true; break; @@ -385,9 +383,9 @@ bool exclusionCheck(string file, bool file_chk) { bool rt = false; - for (int x = 0; x < exclusionFileList.Length; x++) // Fastest loop mechanizm for this repetative task + for (int x = 0; x < Constants.exclusionFileList.Length; x++) // Fastest loop mechanizm for this repetative task { - if (file.Contains(exclusionFileList[x])) + if (file.Contains(Constants.exclusionFileList[x])) { rt = true; break; From 688ac1f6e04ae39f16382dff0d8e7b31dfd58e1f Mon Sep 17 00:00:00 2001 From: Akutra-Ramses Atenosis Cea Date: Tue, 18 May 2021 02:49:37 -0700 Subject: [PATCH 4/6] Update README.md --- README.md | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 3f708a3..ee3b51a 100644 --- a/README.md +++ b/README.md @@ -52,20 +52,30 @@ To build the application from source code, install Visual Studio (Windows) or Mo - Visual Studio or MonoDevelop - .NET 4.8 (Visual Studio) +Prepare MonoDevelop +- Download your desired target (e.g. mono-6.8.0-ubuntu-16.04-x64) + ``` mkbundle --fetch-target mono-6.8.0-ubuntu-16.04-x64 ``` +- Locate the machine.config file (e.g. ~/.mono/targets/mono-6.8.0-ubuntu-16.04-x64/etc/mono/4.5/machine.config) +- Modify the machine.config file remove the references to "$mono_libdir/" in front of all libmono-native.so +- Locate libmono-native.so (e.g. /usr/lib/libmono-native.so) because you will need the path for mkbundle. -### Build the App + +### Build the App on Linux Change install prefix if needed: ```bash +cd ~/mono git clone https://github.com/Akutra/hypersync-console.git -cd hypersync +cd hypersync-console/hypersync +msbuild hypersync.csproj -p:Platform=x64,Configuration=Release +mkbundle -o hypersync --cross mono-6.8.0-ubuntu-16.04-x64 bin/Win/x64/Release/Hypersync.exe --machine-config /etc/mono/4.5/machine.config --library /usr/lib/libmono-native.so ``` You can now run the built app. ```bash -hypersync v +./hypersync v ``` ## Contributions From f9c3092ae5bc12637413ce2734ea1c854575f648 Mon Sep 17 00:00:00 2001 From: Akutra-Ramses Atenosis Cea Date: Tue, 18 May 2021 19:48:32 -0700 Subject: [PATCH 5/6] Update README.md --- README.md | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ee3b51a..9eacfa3 100644 --- a/README.md +++ b/README.md @@ -62,8 +62,6 @@ Prepare MonoDevelop ### Build the App on Linux -Change install prefix if needed: - ```bash cd ~/mono git clone https://github.com/Akutra/hypersync-console.git @@ -77,6 +75,22 @@ You can now run the built app. ```bash ./hypersync v ``` +### Build the App on Windows + +Locate your repos directory (e.g. C:\Users\\source\repos\) +``` +cd C:\Users\\source\repos +git clone https://github.com/Akutra/hypersync-console.git +``` +Open the csproj file in Visual Studio from the repo (e.g. C:\Users\\source\repos\hypersync-console\hypersync\hypersync.csproj +Compile for x64 Release. +Place the resulting exe file in a folder referenced by the %path% variable + +You can now run the built app. + +```bash +hypersync v +``` ## Contributions From aeb9ac5dfdab629234672a127afdd022f0c61333 Mon Sep 17 00:00:00 2001 From: Akutra-Ramses Atenosis Cea Date: Tue, 18 May 2021 19:50:12 -0700 Subject: [PATCH 6/6] Update README.md --- README.md | 7 ------- 1 file changed, 7 deletions(-) diff --git a/README.md b/README.md index 9eacfa3..2372804 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,5 @@ # hypersync -[![Documentation Status]]TBD -[![Translation Status]]TBD -[![Linux Build Status]]Successful -[![macOS Build Status]]TBD -[![Windows Build Status]]Success -[![Coverage Status]]TBD - Folder and file synchronizer. - [Downloads](https://github.com/Akutra/hypersync-console/releases)