Uploading A File on a Remote server to another FTP over SSH

If you work with remote server you may needs to upload your backup into a remote FTP server
if your remote server does not support for FTP .
the one way to do it is download your file in to local machine over SSH and upload it Over FTP
damn it may like 2x data usage (time too)

but you can use curl to do the dirty work for you
most *nix servers come with curl .. if not you can install with out any hassle

curl -v -T "<file path to zip or tar.gz>" ftp://username:password123@my.ftp.com/<path to ftp location>/

loving it right  you can remove -v part if you know what the fuck you do and want to save more kbs over SSH

and here few more curl command thats you must Know 
need to save a file 

curl -o myfile.txt http://www.abc.com/text/me/mytest.txt

download from FTP ok

curl -u ftpuser:ftppass -O ftp://ftp_server/backup/mybackup.zip

once you are in love with curl here is a bones 

curl -u username:password --silent "https://mail.google.com/mail/feed/atom" | tr -d '\n' | awk -F '<entry>' '{for (i=2; i<=NF; i++) {print $i}}' | perl -pe 's/^<title>(.*)<\/title>.*<name>(.*)<\/name>.*$/$2 - $1/'

replace username:password with your gamil credentials 

ok enf fun with curl --- but feel free to post your own ones


Post a Comment