Linux: Recursively FTP Directories Using CLI Using ‘wget’

So you want to recursively copy full FTP directory structures but don’t want to use a GUI client (or can’t)?

Everyone seems to resort to ‘mget’ or multiple-get on the command line but this does not do recursive copies.

The best way is to use wget which will do *exactly* what you want – copy the directories and store them in their original structure. This is incredibly easy to do as follows:

wget -r --user myusername --password mypassword ftp://ftp.mydomain.co.uk/mysite

You’ll see a bunch of entries – one for each file – as follows, showing that it’s working 🙂
--2013-11-16 12:36:48--  ftp://ftp.mydomain.co.uk/websites/testfile.txt

=> `ftp://ftp.mydomain.co.uk/websites/testfile.txt'
==> CWD not required.
==> PASV ... done.    ==> RETR testfile.txt ... done.
Length: 11897 (12K)

100%[==============================================================================>]
11,897      24.1K/s   in 0.5s

Exit mobile version
%%footer%%