How to download a directory over FTP?

I want to download a directory over FTP. The directory is very large, and it would be useful if I can pause and resume the download as needed.

The target FTP directory is static. That is, it’s contents won’t change in time. And no authentication is needed.

What’s the best tool to do this job?

Asked By: becko

||

You can do it with curl :

curl -u user:password 'ftp://site/folder/file.txt' -o /tmp/file.txt

or with gui FileZilla

Answered By: José Ricardo Pla

wget should work:

wget -r -l 0 ftp://username:password@some.host/some_dir/*

wget is tool for downloading files.

  • -r means recursive.
  • -l 0 for infinite recursion, because -r by default have recursion depth of 5.
  • some_dir/ is relative to user home dir. If you want absolute path add one more / after host name.

Maybe you have to use --user and --password arguments to get it to work on Ubuntu.(according to https://stackoverflow.com/questions/113886/how-do-you-recursively-ftp-a-folder-in-linux)

Answered By: Nemanja

I would use lftp and mirror function in it. You can download files in pararell, stop, resume, limit speed etc.

Alternativly – you can use wget

wget -m -c ftp://serwer/directory

If you wish to stop – simply stop wget. For resume – do it again – it will not download files which was already downloaded.

If you wish to download/reject specific files you can use -A or -R option (or – if you wish to specify it via regexp – –accept-regex/–reject-regex)

Answered By: undefine

AFAIK ftp doesn’t support downloading the directory directly.

You can use FileZilla for this purpose. It stores all your transfer in queue. You can resume the transfer later once it is paused or when you reconnect to server.

Answered By: g_p

I tried those commands but wget interpreted user:pass has being the server and port so i ran this command and it worked, hope it help :

wget -m -c 'ftp://servidor/directory/' --ftp-user=<your ftp username> --ftp-password=<your ftp password>
Answered By: bener07
Categories: Answers Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.