wget FTP:如何在没有 .listing 文件的情况下递归下载整个目录?

use*_*173 3 linux ftp download wget

我想从我的 FTP 服务器下载整个目录,可以通过使用wgetwith-m选项来完成。

wget -m --ftp-user=aaaa --ftp-password=bbbb ftp://xxx.xxx.xxx.xxx/dir
Run Code Online (Sandbox Code Playgroud)

但是,我注意到.listing所有目录下都创建了文件,我不想要这些文件。我了解到wget有选项--no-remove-listing,但似乎没有相反的选择。是否可以在不创建.listing文件的情况下镜像目录?或者,有没有比 更好的工具wget

Kam*_*ski 5

我了解到wget有选项--no-remove-listing,但似乎没有相反的选择。

不需要这样的选择。你只是不使用--no-remove-listing. 在您的情况下,此选项是隐式设置的,因为-m.

来自man 1 wget

-m
--mirror
打开适合镜像的选项。此选项打开递归和时间戳,设置无限递归深度并保留 FTP 目录列表。它目前相当于-r -N -l inf --no-remove-listing.

结论:不要-m使用不带 的 等效选项--no-remove-listing,即-r -N -l inf

wget -r -N -l inf --ftp-user=aaaa --ftp-password=bbbb ftp://xxx.xxx.xxx.xxx/dir
Run Code Online (Sandbox Code Playgroud)

另一种方法:(curlftpfs使用cp或其他方法)。看到我的这个答案