The FTP protocol is simple to use. In a console, type ftp <host> to connect to your host. Enter your login and password when prompted and use get to download and put to upload a file.
But what about doing that in a bash script ?

Here is a working example of an FTP upload within a bash script:

1
2
3
4
5
6
ftp -v -n $HOST_FTP <<SCRIPT
quote USER $LOGIN_FTP
quote PASS $PASS_FTP
put $FILE_NAME
bye
SCRIPT

Extra tip: if you need to download more than one file, use mget instead of get. The same works for mput instead of put.

Filed under: Computing, Debian, Système, Terminal

Tagged with: , , , ,

Liked this page?

Tweet it

Subscribe to the RSS feed or sign up for the newsletter now.

Posts related to FTP upload in a script

Name (required)

Email (required)

Website

Leave a Reply

  • About Me


    photo of Samantha Halfon Samantha Halfon
    Software Engineer
    blueKiwi software
    Paris, France
    I enjoy playing with my computer(s), listening to Bob Dylan (and related artists) and watching movies (especially if they were directed by Martin Scorsese or John Cassavetes). Sometimes, I play a little guitar... If not doing any of the above, I am either riding a small red bike around Paris, or, making videos. About my videomaking please check out World Wide Angle and its blog.