2

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?

1

5 Answers 5

6

wget should work:

wget -r -l 0 ftp://username:[email protected]/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)

2
  • 1
    And how to pause/resume download?
    – a06e
    Feb 2, 2015 at 16:31
  • 1
    Stop it, and then start it again for resuming. It will start where it was stopped.
    – Nemanja
    Feb 2, 2015 at 16:38
0

You can do it with curl :

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

or with gui FileZilla

1
  • I want to download an entire directory (along with its contents, recursively), not a single file.
    – a06e
    Feb 2, 2015 at 16:28
0

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.

0

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)

2
  • wget downloads a lot of garbage files (index.html, and other useless stuff). How can I prevent that?
    – a06e
    Feb 2, 2015 at 17:17
  • hm? wget in ftp should download only this, what is in directory. If there is no index.html file - it shouldn't download nothing like it. Maybe are you download via http protocol? When are you using -m option - only one created file is .listing used for caching list of files in directory. 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).
    – undefine
    Feb 2, 2015 at 17:45
0

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>

You must log in to answer this question.

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