diff --git a/README.md b/README.md index 8c7325e..2372804 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,90 @@ # hypersync -Folder and file synchronizer. Update folders with only newer files. Easily maintain duplicate or migrated data. + +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) + +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 on Linux + +```bash +cd ~/mono +git clone https://github.com/Akutra/hypersync-console.git +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 +``` +### 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 + +To Be Determined. 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/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..a42f38b 100644 --- a/hypersync/SyncCopy.cs +++ b/hypersync/SyncCopy.cs @@ -11,11 +11,10 @@ namespace hypersync public class SyncCopy { public reportdata result_data = new reportdata(); + public List UserExclusion = new List(); 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 = ""; @@ -157,7 +156,7 @@ public void CopyFolder(string SourceFolder = "") result_data.total_missingdest++; } - if (copyCurFile) + if (copyCurFile && !ToExcludeFile(cFile) ) { if (!AnalyzeOnly) { @@ -185,12 +184,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 +211,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; @@ -356,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; @@ -372,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; 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; } }