This question already has an answer here:
- Secure FTP using Windows batch script 3 answers
I have the following Windows script that connects to a regular FTP server and downloads files.
However, the files have since been moved to an SFTP server. How can I modify the following script so that it connects to this new secure ftp server? I really don't want to modify too much since it had been working correctly with the past FTP server.
The ftp client I'm using here is the one that's included with Windows.
I'm including the script:
I have a Windows task that runs the following: ftp -s:C:\files\FtpScript.txt
FtpScript.txt has the following contents:
open web.myserver.com 8021
username
password
lcd /Data/2014/0113
prompt
get /var/opt/Data1200.xml
get /var/opt/Data1300.xml
get /var/opt/Data1400xml
Windows command line FTP client does not support SFTP protocol.
You can switch to WinSCP:
replace your command line with:
replace your connection and authentication commands with:
the
lcd
can stay (though/Data/2014/0113
does not look like a local path)get
needs a target path, use.\
to download to the local current working directory.exit
commandFor details, see Secure FTP using Windows batch script or WinSCP guide for Converting Windows FTP script to WinSCP SFTP script
(I'm the author of WinSCP)