I just wrote a quit batch for something and figured it would make a good tutorial or quick refresher for anyone wanting to know dos commands or how to automate a ftp download/delete in command line. Many FTP clients will allow you to automate downloads using a synch process but it is hard to find one that will automate deletion. I needed to download a daily file and delete it after i was done while being able to log everything. Here you go:
1) first thing you need to do is create a bat file
2) open up notepad, add quoted below and save file w/ .bat exentsion to c:\
3) bat file contains the following
cd c:\ = change directory c:\cd c:\
ftp -s:ftp.txt mywebsite.com >> c:\ftp_log.log 2>>&1
ftp = ftp command
-s:ftp.txt = run this text file
mywebsite.com = the site i want to ftp into
>> = needed to separate commands
c:\ftp_log.log = the file i want to write to; this will allow me to track my process
2>>%1 = append to file so i can see every time this file runs in one file
4) create ftp.txt file to hold all of our login credentials(see quoted below) and run commands
username = username needed to loginusername
password
cd inbox
mget *
y
mdelete
*
y
close
quit
password = password needed to login
cd inbox = change directory to location in ftp needed
mget * = get any file
y = yes (confirmation)
mdelete * = delete any file
y = yes (confirmation)
close = close connection
quit = quit bat
5) Then under Start > Accessories > System Tools > Scheduled tasks you can set the task to run as needed.
Google FTP Commands if you need to alter anything - Enjoy!