FTP
FTP was created in a different era of the Internet and computers and as such it
works a little bit differently than most other protocols. These differences
can often be ignored and things will just work, but they are also
important to know at times when things don’t run as planned.
The FTP protocol is a command and response protocol; the client sends a
command and the server responds. If you use curl’s option you will get to
see all the commands and responses during a transfer.
When an FTP client is about to transfer data, it specifies to the server which
“transfer mode” it would like the upcoming transfer to use. The two transfer modes
curl supports are ‘ASCII’ and ‘BINARY’. Ascii is basically for text and
usually means that the server will send the files with converted newlines
while binary means sending the data unaltered and assuming the file is not
text.
curl will default to binary transfer mode for FTP, and you ask for ascii mode
instead with -B, --use-ascii
or by making sure the URL ends with .
If you want to provide another user name and password, you can pass them on to
curl either with the -u, --user
option or embed the info in the URL:
curl —user daniel:secret ftp://example.com/download