Synchronize files to an SFTP server

6

1

Other than WinSCP, is there a program that can do an SFTP file synchronization of folders in Windows? I'd like to find a simple way to add directories to be backed up to my SFTP server. I'd like to run it as a scheduled task each night.

I am able to do this with WinSCP, but since my scripting is horrible, I have about 10 configuration files for each transfer and adding new ones is a paid in the neck.

user277244

Posted 2013-11-27T01:31:59.687

Reputation: 251

Do you have rsync on the server (many Linux servers do)? If so, try using something like this. It's likely to be considerably faster and possibly easier to setup.

– wingedsubmariner – 2013-11-27T05:10:34.223

Yes, I've tried it but it has a 260 or so character limit and this causes major issues. It's hard for me to believe that people rely on this program when it has such an obvious limitation. You just can't trust it. – user277244 – 2013-11-27T06:25:27.017

Answers

2

What about making your WinSCP script easier to maintain?

I suppose all you need is to put one synchronize command per directory to your script. That does not sound too difficult to maintain.

I.e. your script (script.txt) would be like:

open sftp://user:password@example.com -hostkey="server_hostkey"

# one synchronize command per directory
synchronize remote C:\local_directory1 /home/user/remote_directory1
synchronize remote C:\local_directory2 /home/user/remote_directory2
...
synchronize remote C:\local_directoryN /home/user/remote_directoryN

exit

And you add a task to Windows Scheduler with command-line like:

"C:\Program Files\WinSCP\WinSCP.exe" "/script=path_to_script\script.txt" "/log=path_to_script\script.log"

Ideally also add the /ini=nul to command-line to isolate your script from environment.

Martin Prikryl

Posted 2013-11-27T01:31:59.687

Reputation: 13 764

Thanks. I will try that. I was using one file per command, I'll give that a shot. – user277244 – 2013-11-28T05:05:39.290

Did this help you? – Martin Prikryl – 2013-12-04T17:45:35.853

Yes, but actually, looks like I may need to rsync over ssh as I have a new client with 1.4 million files to sync. It took winscp 24 hours to do the sync. No way to do a daily backup when it takes all day. – user277244 – 2013-12-08T05:12:15.133

Was that full initial sync? Did you try second incremental sync? – Martin Prikryl – 2013-12-08T06:45:58.813

Full initial sync took 36 hours. Second incremental sync took 24 hours. What do big companies use when they have this many files? Rsync can't be the only option. Too much stuff to install inside windows if I can avoid it. – user277244 – 2013-12-09T04:41:43.517

You may try splitting the task into subtask, each synchronizing part of a tree and run them in parallel. – Martin Prikryl – 2013-12-09T06:45:09.063