wget FTP: how to recursively download a whole directory WITHOUT .listing files?

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://

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

1 Answer

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://

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

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like