SshFileSync synchronizes all local files of a Windows directory to a remote Linux host via SSH and SFTP or SCP (if SFTP is not supported).
To upload only changed files, an additional cache file '.uploadCache.cache' is stored in the destination folder. Don't delete this cache file!
SshFileSync Host Port Username Password LocalDirectory RemoteDirectory
Example: To sync all files from "C:\Temp" to "/home/root/SyncedTemp" on a remote machine with ip 192.168.100.24:
SshFileSync 192.168.100.24 22 root Password "C:\Temp" "/home/root/SyncedTemp"
SshFileSync BatchFilename.csv
Example: To sync all directories from a csv file "MySSHFileTransfers.csv"
SshFileSync "MySSHFileTransfers.csv"
CSV-Fileformat:
Host;Port;Username;Password;LocalDirectory;RemoteDirectory
You can use the C# class SshDeltaCopy in your own .Net program:
var options = new SshDeltaCopy.Options() {
Host = "192.168.100.24",
Port = 22,
Username = "root",
Password = "Password",
RemoveOldFiles = true,
PrintTimings = true,
RemoveTempDeleteListFile = true,
};
using (var sshDeltaCopy = new SshDeltaCopy(options))
{
sshDeltaCopy.DeployDirectory(@"C:\App\MyAppBin", @"/usr/bin/MyApp");
sshDeltaCopy.DeployDirectory(@"C:\App\PublicContent", @"/home/shared/public");
sshDeltaCopy.DeployDirectory(@"C:\App\PrivateContent", @"/home/root/private");
sshDeltaCopy.RunSSHCommand("ls -al");
}
- Does not delete or create empty directories
- Supports only Windows as local machine and Linux/Unix as remote machine
2018-03-25
- Bugfix: Change the working directory only if we use ScpClient.
2017-10-22
- Feature: Feature: Support for output redirection with property LogOutput.
2017-10-21
- Bugfix: "set -e" added at the beginning of the upload script. (Exit immediately if a command exits with a non-zero status.) Errors, such as 'tar: write error: No space left on device', during the upload process were not discovered.
- Bugfix: Upgraded to Renci.SshNet 2016.1.0.0 to avoid crashes with compressed content > 100 MB.
- Bugfix: Batch transfer mode has deployed only to the first path. Added "change working directory" for every batch task.
2017-07-16
- Feature: CreateSSHCommand method implemented
2017-07-15
- Feature: RunSSHCommand method implemented
2017-07-15
- Bug: Crash if the file '.uploadCache.cache' was missing while downloading via SFTP
- Bug: Space in remote destination directory (linux) was not supported
- Feature: Batch support via csv file added (multiple different upload directory with one single connection)
2017-07-12
- Initial Release