Winscp Sync Folder

Posted By admin On 18/01/22
Remote

Recently I upgraded my work laptop to Windows 7. At that time I didn’t want to use the previous sync methods that I have blogged about. I wanted to use something simpler (read easier to install and maintain between different machines). After doing some research I settled on using winscp. Winscp supports folder sync operations through a command line. Winscp takes a simple text file listing the commands that it is to execute. This process can be automated on Windows using batches, one to pull changes and the other to push changes.

SyncWinscp Sync Folder

With /synchronize or /keepuptodate parameter WinSCP performs Synchronize or Keep remote directory up to date commands respectively on the specified session and directories. A dialog to set options is displayed first (Note that this is not intended for automation, see scripting). Parameter /console executes WinSCP in console (scripting) mode. Synchronize from SFTP server to local directory with a script 1. Install WinSCP on a local machine you want to sync files 2. Connect first time only to the server via SFTP GUI to copy server key: 3. Go to WinSCP folder location “C:Program Files (x86)WinSCP” 4. Create a BATCH file.

  1. Synchronize both exit to get it to run I had to use 'C: Program Files WinSCP WinSCP.exe' '53-v2' /script=C: Scripts FTPScript.txt I am calling this job from 4NT but I'm sure it would work with basic CMD and hen could be made into a scheduled task bat file.
  2. FreeFileSync is a folder comparison and synchronization software that creates and manages backup copies of all your important files. Instead of copying every file every time, FreeFileSync determines the differences between a source and a target folder and transfers only the minimum amount of data needed.
Winscp auto sync folder

Create a text file called ‘pull_changes.txt’ and add the following code:

Here is the push script, save the lines to a text file called ‘push_changes.txt’:

Winscp

Winscp Synchronize Exclude Folder

Here is an example of a simple batch file that can be used to execute either of the winscp command files: