How to automate ftp login and file transfer with bash script

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 <

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/.

About Andrew Lin

Hi, I have always wanted to creat a blog site but never had the time. I have been working in Information Technology for over 15 years. I specialize mainly in networks and server technologies and dabble a little with the programming aspects. Andrew Lin

View all posts by Andrew Lin →

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

Leave a Reply

Your email address will not be published. Required fields are marked *