FTP automatically

A friend of mine asked me to help with an FTP issue he was having recently. This reminded me of some older code I had to automatically FTP files to another server. I tend not to do this with FTP these days – I tend to remotely sync with rsync or some tool like that. Anyway, FTP can be really useful if you are trying to go through a list of files or something like that. Here is a little script that allows you to FTP files (in bash) without much hassle or the need to use the FTP console (note the example is for ascii mode):

#!/bin/bash
HOST=’someftplocation.com’
USERNAME=’whatever’
PASSWORD=’whatever’
ftp -n -v $HOST << EOT
ascii
user $USERNAME $PASSWORD
prompt
cd whereyouwannput it
put yourfile.txt
bye
EOT
sleep 12

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: