我试图使用以下命令下载目录中的所有文件:
wget -r -N --no-parent -nH -P /media/karunakar --ftp-user=jsjd --ftp-password='hdshd' ftp://ftp.xyz.com/Suppliers/my/ORD20130908
您需要添加一个尾部斜杠,以指示URL中的最后一项是目录而不是文件:
原文链接:https://www.f2er.com/bash/384130.htmlwget -r -N --no-parent -nH -P /media/karunakar --ftp-user=jsjd --ftp-password='hdshd' ftp://ftp.xyz.com/Suppliers/my/ORD20130908
↓
wget -r -N --no-parent -nH -P /media/karunakar --ftp-user=jsjd --ftp-password='hdshd' ftp://ftp.xyz.com/Suppliers/my/ORD20130908/
Note that,for HTTP (and HTTPS),the trailing slash is very important to ‘–no-parent’. HTTP has no concept of a “directory”—Wget relies on you to indicate what’s a directory and what isn’t. In ‘07001’,Wget will consider ‘bar’ to be a directory,while in ‘07002’ (no trailing slash),‘bar’ will be considered a filename (so ‘–no-parent’ would be meaningless,as its parent is ‘/’).