title: Transfer files from FTP server to local unix server
body: <p>I have to transfer files whose names consists of two variables X, Y and they are in the directory ABC in ftp server to my local unix directory XYZ. after transfering files i have to go to local directory path and I should untar (input files are compressed files) them. I have to use username and password for connecting to FTP. When copying files to local server also I have to use my username and password.</p>
  
  <p>Here's my current attempt. Will it work? How can I improve it?</p>
  
  <pre><code>ftp -n hostname &lt;&lt;EOF
  user username pwd
  cd ABC
  get ls *X*.tar | ls *Y*.tar username1@pwd1 : XYZ
  EOF
  bye
  for next in `ls *.tar`
  do
  tar -zvxf $next
  done
  </code></pre>