How to automate an FTP session
FTP is used inside companies to shift data about from place to place, a typical task is to move text reports and logs from unix workhorses to windows/novell shares. Using simple scripting, it's possible to automate ftp jobs.
Create the script
create a text file called this_script.txt
open [servername] [username] [password] cd [yourpath] prompt mget * bye
example:
open OddJob bobajob bob cd /exports/reports/jobs/oddbobs prompt mget * bye
Run the script
ftp -s:this_script.txt
the -s parameter tells ftp to run the series of commands stored in the script.
This will extract the files to the current directory, so it's then easy to create a batch job that will move to the right place and then run the ftp script, along the lines of
> copy con get_reports.cmd chdir c:\my_cache\reports ftp -s:this_script.txt ^Z (f6 key) >