Wednesday, 28 February 2018

Schedule this Batch to Download via FTP | Windows

We can use Linux-based utilities which are more secure and available for windows, like "wget" and "WinSCP" which is also a good option, but I preferred to stay in windows using the default old FTP command. Or we also can use Powershell instead of the old command-prompt-based batch file.


Anyhow, below is just one windows command using echo to redirect the text in a file and then the file will be called by FTP.

Just Run or you can write this command in a batch file to schedule.

cd /d "C:\Users\AQ\INTEGRATION\download"

echo open 10.152.30.229 >> ftp.txt & echo user myuser mypassword >> ftp.txt & echo binary >> ftp.txt & echo get "filename.dat" >> ftp.txt & echo bye >> ftp.txt & ftp -n -v -s:ftp.txt & del ftp.txt


1. 1st line is the path, where you want to download. 

2. Replace myuser and mypassword with the real FTP user credentials.

3. This script will create a file ftp.txt, and at the end of the line: this file is called by FTP before deletion. 


Note: Security concerns: username and password are written here. 

We also can use power sh


No comments:

Post a Comment