Rick Hurst Web Developer in Bristol, UK

Menu

DOS batch ftp using mget with no user input

by default when you initiate an FTP session under DOS, the default mode is interactive. If you want to create a batch file to download multiple files and you dont want to have to manually accept each transfer, enter the word “prompt” which will toggle the interactive mode on or off

e.g.:-

open www.mywebsite.com
user myusername mypassword
cd mydesireddirectory
prompt
mget *.xml
quit

the above example will download everything with a .xml file extension

I saved those commands in a file called xml_download_commands.txt and created a batch file with the following commands:-

cd C:downloads
ftp -n -s:xml_download_commands.txt

i’m using something like the above to connect to this site and download the archives periodically as an automated scheduled task so that I have a local copy if the web server was to blow up or something

Posted in Uncategorised