I had a similar need, and after reading through the site, I arrived at this script which allows me to synchronize the files from a remote server to my local PC. I do this so that I have a copy of the most recent backups from my server to my PC.
I was delighted to find WinSCP as it allows me to do secure transfers between my server and my local PC, which I consider to be essential.
I have a directory on my server named "backups." In this directory, I have another directory, "archives" which holds the files that I want to copy. In "backups," I also have the script files to do my backups.
My script was derived from some I found on this site. At first, I planned to copy files from my server to my local PC, but then I found "synchronize" and this works better for me as it only copies the new files, that is, the most recent backups. I left the copy commands for reference. The script is:
# Automatically answer all prompts negatively not to stall
# the script on errors
option batch on
# Disable overwrite confirmations that conflict with the previous
option confirm off
# Connect
open user@server.org
# Change remote directory
cd backups
# Force binary mode transfer
option transfer binary
# Download file to the local directory
# get archives/* f:\backups\archives\*
# Delete downloaded files
# rm archives/*
# sync from remote to local
synchronize local f:\backups\archives archives
# Exit WinSCP
exit
I used Windows XP Scheduled Tasks to run this program weekly, a few hours after the backup is generated on the server. The command I used in Scheduled Tasks is:
C:\PROGRA~1\WinSCP\WinSCP.exe /console /script=f:\backups\download.txt /log=f:\backups\winscp.txt
This command runs WinSCP and uses the script "download.txt" and logs the results to "winscp.txt" These files are on my F: drive in the backups directory.
I hope that this script is useful to others.