This is an old revision of the document!
Schedule file transfers (or synchronization) to FTP/SFTP server
This guide contains simplified description of scheduling operations on FTP/SFTP server with WinSCP.
To schedule an operation on FTP/SFTP server you can combine scripting/automation functionality of WinSCP with Windows scheduling capability.
Before starting you should:
- Have WinSCP installed;
- Know how to connect to your FTP/SFTP account;
- Automate your operations using WinSCP scripting functionality.
Scheduling on Windows 7
To add new scheduled task:
- Go to Windows Start Menu > Control Panel > System and Security > Administrative Tools > Schedule Tasks.
- In the Task Scheduler menu go to Action > Create Basic Task.
- Give your task a name and click Next.
- Choose when the task should be run and click Next.
- For task action, select Start a program and client Next.
- Browse for
WinSCP.com
executable. - In Add arguments add appropriate WinSCP command-line parameters to execute the scripting commands you need (typically you will use
/script or
/commandparameters).
/command "option batch abort" "option confirm off" "open user:password@example.com" "put d:\examplefile.txt /home/user/" "exit"
The resulting arguments may look like: - You may want to use /log
parameter to turn on session logging to file.
- When done, click Next, review your options and confirm with Finish.
If something does not work, and you want to debug, you can do it like this: Go to Windows Start Menu > Run . And then type cmd and hit Enter. Then you type something like
C:\some program folder\WinSCP\WinSCP.exe /console , and hit Enter. Now you can test one single command at a time. First you usually want to test open user:password@example.com . And then perhaps put d:\examplefile.txt /home/user/ . And see what happens, and not.
Scheduling on Windows XP and Earlier
To add new scheduled task:
- Go to Windows Start Menu > Settings > Control Panel > Scheduled Tasks > Add Scheduled Task.
- Browse for WinSCP.com
executable, and setup other task properties (like period of execution).
- In advanced properties add appropriate WinSCP command-line parameters to execute the scripting commands you need (typically you will use /script
or
/commandparameters).
"C:\Program Files\WinSCP\WinSCP.com" /command "option batch abort" "option confirm off" "open user:password@example.com" "put d:\examplefile.txt /home/user/" "exit"
The resulting command may look like: - You may want to use /log
parameter to turn on session logging to file.
If something does not work, and you want to debug, you can do it like this: Go to Windows Start Menu > Run . And then type cmd and hit Enter. Then you type
C:\Program Files\WinSCP\WinSCP.exe /console’' , and hit Enter. Now you can test one single command at the time. First you usually want to test open user:password@example.com . And then perhaps put d:\examplefile.txt /home/user/ . And see what happens, and not.
Further Reading
- FAQ on scheduler to prevent common mistakes with scheduling;
- Troubleshooting;
- Guide to automation;
- Command-line parameters;
- Scripting documentation.