FTP script example

A while back, I was uploading a bunch of stuff via FTP and needed a FTP script to automate things. However, I couldn’t find a clear example script out there and this simple script ended up taking quite a bit longer to write.

Anyway, for anyone who’s searching out there for a FTP script example, here’s something you may appreciate:

#!/bin/bash
#...
# (Other commands in script)
# ...
ftpCmd="open someserverdomain.com 21
user aUser aPassword
passive
bin
cd uploads
mput *
bye
"
echo "$ftpCmd"|ftp -niv

The tricked as you can see is to store the FTP commands into a variable, then echo that to the "ftp" command.

Have fun FTP-ing, lol.

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: