I need to upload a single file to FTP server from Ubuntu. This operation should be done in a script (in non-interactive mode). What is the right syntax for ftp
?
I'm trying this, to no avail:
$ ftp -u ftp://user:secret@ftp.example.com my-local-file.txt
ftp: Invalid URL `ftp://'
Best Answer
Here is one approach:
Alternatively, create (or edit) the ~/.netrc file in the home dir of the user that will run the ftp command, give it appropriate perms (
chmod 0600 ~/.netrc
), and add the following:Then omit the login information, as in:
Also, here's how you might do the same thing using curl: