Reputation: 132
I am trying to do an automated backup from a FTP server to a local external hard drive. The following script works with WinSCP when run manually from the external hard drive destination folder:
E:\Backups\FTP>"C:\Program Files (x86)\WinSCP\WinSCP.com" /ini=nul /script="E:\Backups\ftptpp.txt"
I have little experience with scheduling tasks in Windows and am using Windows 8.1. Following the WinSCP guide, I have written this so far:
"C:\Program Files (x86)\WinSCP\WinSCP.exe" /log="C:\Program Files (x86)\WinSCP\WinSCP.log" /ini=nul /script="E:\Backups\ftptpp.txt"
However, in the original script I ran manually, I ran it from the destination folder. How do I specify in the task scheduler where the destination folder is located (E:\Backups\FTP)?
For reference, the ftptpp.txt script looks like this:
# Connect
open ftp://username:[email protected]/
# Change remote directory
cd /
# Download file to the local directory
synchronize local
# Disconnect
close
# Exit WinSCP
exit
Upvotes: 1
Views: 426
Reputation: 202168
When specifying an "Action" for your scheduled task, there's a field called "Start in". That corresponds to the directory you "ran" your script manually from, i.e. the "destination folder" E:\Backups\FTP
.
Though I'd personally suggest you to specify the destination folder directly in WinSCP script:
synchronize local E:\Backups\FTP /
or
cd /
lcd E:\Backups\FTP
synchronize local
See https://winscp.net/eng/docs/scriptcommand_synchronize
Side note: Unless you run the task with Administrator privileges (what you should not!), you cannot log to "Program Files" folder, so this will not work:
/log="C:\Program Files (x86)\WinSCP\WinSCP.log"
Upvotes: 1