3

I want to download a whole directory from my FTP server, and it can be done by using wget with -m option.

wget -m --ftp-user=aaaa --ftp-password=bbbb ftp://xxx.xxx.xxx.xxx/dir

However, I noticed that .listing files are created under all directories, and I don't want these files. I learned that wget has the option --no-remove-listing, but it seems there is no option to do the opposite. Is it possible to mirror directories without creating the .listing files? Or, is there any better tool than wget?

1 Answers1

4

I learned that wget has the option --no-remove-listing, but it seems there is no option to do the opposite.

There's no need for such option. You just don't use --no-remove-listing. In your case this option is implicitly set because of -m.

From man 1 wget:

-m
--mirror
Turn on options suitable for mirroring. This option turns on recursion and time-stamping, sets infinite recursion depth and keeps FTP directory listings. It is currently equivalent to -r -N -l inf --no-remove-listing.

Conclusion: instead of -m use equivalent options without --no-remove-listing, i.e. -r -N -l inf:

wget -r -N -l inf --ftp-user=aaaa --ftp-password=bbbb ftp://xxx.xxx.xxx.xxx/dir

Another approach: curlftpfs (with cp or whatever). See this answer of mine.