1

I try to FTP a file with a one liner in a shell from a mac to a folder on my server. Doing the same in the FTP-Shell is not a problem for me, but doing this in one line is not possible to me.

I even do not succeed with the following simple connecttest, which I guess is standard on every other system:

ftp name:password@mysite

How to transfer a file in one commandline with following info?

filename: <file>
server:<server>
username:<username>
password:<password>
pathonserver:<path>

ftp <username>:<password>@<server> "cd <path>;put <file>" ?

  • does ftp ftp://<user>:<pass>@<server>/<path> work ? – Mateusz Szlosek Jan 20 '16 at 11:29
  • Yes that works. Thanks, thats a good start. And how to put the file ? – user1344545 Jan 20 '16 at 12:15
  • It's ftp -u ftp://<user>:<pass>@<server>/<path> /path/to/file. – Mateusz Szlosek Jan 20 '16 at 12:18
2

To upload a file to the specific path using ftp command you have to:

ftp -u ftp://<user>:<pass>@<server>/<path> /path/to/file

From man ftp:

 -u URL file [...]
             Upload files on the command line to URL where URL is one of
             the ftp URL types as supported by auto-fetch (with an
             optional target filename for single file uploads), and file
             is one or more local files to be uploaded.

For auto-fetch URLs also look into man ftp under AUTO-FETCHING FILES section.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .