How To: download or upload recursively using command line FTP
Ever wanted to download or upload a folder recursively from an FTP server via command line? It’s a real pain trying to get to do that using traditional FTP client. In fact, it’s impossible with the default FTP client.
That’s why, in this article we’ll be listing several command-line FTP clients with examples on how to recursively upload and download. Each come with bunch of other great features that are very useful.
LFTP
A sophisticated ftp/sftp/http client, file transfer program supporting a number of network protocols. To stay on topic, we’ll discuss only the FTP features of it.
Here is an example of connecting to ftp.mynitor.com, and download everything recursively:
$ lftp -u username,password ftp.mynitor.com lftp :~> mirror <directory>
An example of uploading recursively:
lftp :~> mirror -R <directory>
That’s it! I could go on with examples but to get you started, check out the basic usage document here.
NCFTPPUT / NCFTPGET
This is an oldie but it comes with a two small separate programs called ncftpput and ncftpget that are pretty useful for doing exactly doing that. Example to upload a directory:
$ ncftpput -R ftp.mynitor.com /website /tmp/website
An example to download a directory tree:
$ ncftpget -R ftp.mynitor.com /tmp /pub/mynitor
For more examples, check out the man page here.
- Download ncftpput and ncftpget
I just signed up to your blogs rss feed. Will you post more on this subject?
Absolutely.