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
- Scheduling on Windows 11, Windows 10, Windows 8 and Windows 7
- Scheduling on Windows XP and Earlier
- Scheduling using Microsoft Azure WebJobs or Azure Functions
- Further Reading
Advertisement
Before Starting
Before starting you should:
Scheduling on Windows 11, Windows 10, Windows 8 and Windows 7
To add new scheduled task:
- Open Task Scheduler:
- Windows 11: Go to Windows Start Menu > All apps > Windows Tools > Task Scheduler. Or just type “Task Scheduler” into the search box.
- Windows 10: Go to Windows Start Menu > Windows Administrative Tools > Task Scheduler. Or just type “Task Scheduler” into the search box.
- Windows 8.1: Right click Windows Start button and select Control Panel. In Control Panel, go to System and Security > Administrative Tools > Schedule Tasks.
- Windows 7: Go to Windows Start Menu > Control Panel. 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). - You should also add
/log
parameter to turn on session logging to file. - The resulting arguments may look like (as a single line):
/log=c:\path\winscp.log /command "open sftp://user:password@example.com/" "put d:\examplefile.txt /home/user/" "exit"
Note that the command-line parameter/console
was not specified, which makesWinSCP.exe
not show the console window, so as not to disturb you while you are using your workstation.
You can have WinSCP generate the command-line template for you. - If your script uses local paths relative to the script path or WinSCP executable path, specify the respective path in Start in field.
- When done, click Next, review your options and confirm with Finish.
Advertisement
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). - You should also add
/log
parameter to turn on session logging to file. - The resulting command may look like (as a single line):
"C:\Program Files (x86)\WinSCP\WinSCP.exe" /log=c:\path\winscp.log /command "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 can have WinSCP generate the command-line template for you. - If your script uses local paths relative to the script path or WinSCP executable path, specify the respective path in Start in field.
Scheduling using Microsoft Azure WebJobs or Azure Functions
You can use WinSCP from an Azure WebJob or an Azure Function as a cloud-hosted scheduled task.
Further Reading
- FAQ on scheduler to prevent common mistakes with scheduling;
- Debugging transfer task running in Windows Scheduler or generic troubleshooting guide;
- Guide to automation;
- Command-line parameters;
- Scripting documentation.