Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I can use WinSCP GUI just fine to copy a folder from a Linux server locally to a Windows server for backup, using the "updated files/folders only" option (sort of an rsync).

I'd like to use WinSCP's command line utility or something similar that I can schedule through the Windows task scheduler to grab the folder (plus subfolders/files) from the Linux server nightly and store it on the Windows server.

I looked at the WinSCP docs but I'm scared to try any of the commands without really knowing which ones to run, etc. because the last thing I want is to accidentally write the files in the wrong direction.

Anyone able to tell me the WinSCP commands (or a similar utility) that I can schedule to do the following:

Copy folder/subfolder/files (only new or updated) from "/shared/svnrepos" on the linux server to "\WINSERVER\BACKUP"

share|improve this question
    
If you are scared/worried about something, then why not setup a VM for testing things in? One good way to figure things out is to just try things and see what happens. You won't get that experience, if you don't create an environment where you can test things safely. –  Zoredache May 17 '12 at 19:56
    
True. I was probably looking for the easy way out. I'll do some testing on my own and then if necessary update the question or just close it. –  TheCleaner May 17 '12 at 20:04
    
Asking the question is fine, someone might know the answer. If you do figure it out, then you can/should post an answer to this so that you can help the next guy. –  Zoredache May 17 '12 at 20:09

1 Answer 1

up vote 2 down vote accepted

I think the documentation explains it pretty clearly: http://winscp.net/eng/docs/scriptcommand_synchronize

You want to use the synchronize command instead of a get command.

When the first parameter is local, changes from remote directory are applied to local directory. When the first parameter is remote, changes from the local directory are applied to the remote directory.

As you can see there is very little risk of damaging your servers files if you use syncronize local, since it will take the remote directory and apply it to your local directory.

I would create a script file and then add a scheduled task to call WinScp with:

WinScp.exe /script="d:\SvnBackupScript.txt"

Then put something like the following in your script file:

synchronize local d:\svnBackup /shared/svnrepos

Make sure you have your configuration and connection setup per the documentation.

You can always run it in cosole mode and test your commands:

WinScp.exe /console

Then just type the commands you want in your script

share|improve this answer
    
Just wanted to say thanks. That helped reassure me and i tested multiple times and everything works well. –  TheCleaner May 26 '12 at 2:56

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.