How to automate ftp login and file transfer with bash script

August 27, 2009
By Andrew Lin

Sometime ago I had posted a Korn script to automate FTP login and upload of file on a Unix or Linux computer. The default shell for most Linux servers is bash. I ran into a situation on a VMware ESX server where the only shell available is bash. I had rewrite my script in the bash shell, here it is.

# !/bin/bash
# Andrew Lin
# www.gamescheat.ca
filename=”file-to-upload”
hostname=”remote-ftp-server”
username=”andrew”
password=”secret”
cd /home/mydir
ftp -vn $hostname < quote USER $username
quote PASS $password
binary
put $filename
quit
EOF

Here is the link to the Kron version of the script http://www.gamescheat.ca/2009/08/06/how-to-automate-ftp-login-and-file-transfer/.

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • Reddit
  • StumbleUpon
  • Technorati
  • Twitter
  • Slashdot
  • del.icio.us
  • IndiaGram
  • IndianPad

Tags: ,

One Response to “ How to automate ftp login and file transfer with bash script ”

Leave a Reply