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.
Advertisement
Scheduling on Windows 7 and Windows 8
To add new scheduled task:
- Go to Control Panel:
- Windows 8: While on desktop, go to the charms (press
Win+C
or move mouse cursor to either right screen corner) and select Settings > Control Panel. - Windows 7: Go to Windows Start Menu > Control Panel.
- Windows 8: While on desktop, go to the charms (press
- In Control Panel, go to 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 click Next.
- Browse for
WinSCP.exe
executable. - In Add arguments add appropriate WinSCP command-line parameters to execute the scripting commands you need (typically you will use
/script
or/command
parameters).
The resulting arguments may look like:
/command "option batch abort" "option confirm off" "open sftp://user:password@example.com/" "put d:\examplefile.txt /home/user/" "exit"
Note that the command-line parameter/console
was not specified, what makesWinSCP.exe
not show the console window, not to disturb you while you are using your workstation. - 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.
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.exe
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/command
parameters).
The resulting command may look like:
"C:\Program Files (x86)\WinSCP\WinSCP.exe" /command "option batch abort" "option confirm off" "open sftp://user:password@example.com/" "put d:\examplefile.txt /home/user/" "exit"
Note that the command-line parameter/console
was not specified, what makesWinSCP.exe
not show the console window, not to disturb you while you are using your workstation. - You may want to use
/log
parameter to turn on session logging to file.
Advertisement
Scheduling on Microsoft Azure WebSite with Azure WebJobs
If you need to schedule a file transfer/synchronization task on Azure WebSite, you can use WinSCP from a WebJob. You can also use the WebJob without having an actual web site as a cloud-hosted scheduled task.
Further Reading
- FAQ on scheduler to prevent common mistakes with scheduling;
- Troubleshooting;
- Guide to automation;
- Command-line parameters;
- Scripting documentation.