Skip to content

Commit

Permalink
Merge pull request #2 from Akutra/future_master144
Browse files Browse the repository at this point in the history
Future master144
  • Loading branch information
Akutra authored May 19, 2021
2 parents 6adb364 + aeb9ac5 commit 9f1fd91
Show file tree
Hide file tree
Showing 7 changed files with 127 additions and 16 deletions.
90 changes: 89 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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\<user>\source\repos\)
```
cd C:\Users\<user>\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\<user>\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.
3 changes: 2 additions & 1 deletion hypersync/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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", "~$" };
}
}
11 changes: 10 additions & 1 deletion hypersync/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ static class Program
{
static DisplayManager OutputManager = new DisplayManager();
static configLoader ConfigManager = new configLoader(OutputManager);
static List<string> UserExcludes = new List<string>();
static bool SaveAndExit = false;

/// <summary>
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand All @@ -143,12 +148,16 @@ static void ProcessArgument(string argument, int apos)
OutputManager.AppendToConsole(" [type="); OutputManager.AppendToConsole("<source folder type>", ConsoleColor.White); OutputManager.AppendToConsole("]");
OutputManager.AppendToConsole(" [log="); OutputManager.AppendToConsole("<optional file name>", ConsoleColor.White); OutputManager.AppendToConsole("]");
OutputManager.AppendToConsole(" [loglevel="); OutputManager.AppendToConsole("<level = 1, 2, or 3>", ConsoleColor.White); OutputManager.AppendToConsole("]");
OutputManager.AppendLineToConsole(" [KeepNewerDest] [damaged] [v or version] [h or help] [w]");
OutputManager.AppendToConsole(" [x="); OutputManager.AppendToConsole("<exclude folder (ends with slash) or file>", 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); }
Expand Down
4 changes: 2 additions & 2 deletions hypersync/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
29 changes: 20 additions & 9 deletions hypersync/SyncCopy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,10 @@ namespace hypersync
public class SyncCopy
{
public reportdata result_data = new reportdata();
public List<string> UserExclusion = new List<string>();
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 = "";
Expand Down Expand Up @@ -157,7 +156,7 @@ public void CopyFolder(string SourceFolder = "")
result_data.total_missingdest++;
}

if (copyCurFile)
if (copyCurFile && !ToExcludeFile(cFile) )
{
if (!AnalyzeOnly)
{
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions hypersync/hypersync.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
<ProductName>Hypersync</ProductName>
<PublisherName>Akutra Ramses Atenosis Cea</PublisherName>
<SuiteName>Hyperconnect</SuiteName>
<ApplicationRevision>6</ApplicationRevision>
<ApplicationVersion>1.4.3.%2a</ApplicationVersion>
<ApplicationRevision>1</ApplicationRevision>
<ApplicationVersion>1.4.4.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
Expand Down
2 changes: 2 additions & 0 deletions hypersync/syncconfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -27,6 +28,7 @@ public syncconfig()
this.LogLevel = 3;
// default log file
this.LogFile = "synclog.txt";
this.nofolders = false;
}
}

Expand Down

0 comments on commit 9f1fd91

Please sign in to comment.