#csh script to download a list of files from an ftp directory
#Example: nohup nice download filelist address directory &

# Initialize parameters
set address = $2    #Internet address or name of host
set directory = $3  #Directory from which to get files 

#Create input file containing ftp commands for logging in and 
#going to the right directory. 
echo user anonymous ident   > ftp.input
echo cd $directory >> ftp.input
echo binary >> ftp.input

#Add ftp commands for downloading each file in the list
foreach file (`cat $1`)

  set name = $file
  echo get $name >> ftp.input

  # Create input file for ftp command. Logs in, moves to correct directory,
  # and downloads the data. Then logs out.
end #foreach

echo bye >> ftp.input

#Call ftp using the file list as input
ftp -n $address  < ftp.input
#cat ftp.input #this line for debugging purposes
