shell – 使用wget以–no-parent递归获取目录

我试图使用以下命令下载目录中的所有文件:
wget -r -N --no-parent -nH -P /media/karunakar --ftp-user=jsjd --ftp-password='hdshd' ftp://ftp.xyz.com/Suppliers/my/ORD20130908

但是wget是从父目录中获取文件,即使我指定了–no-parent.我只想要ORD20130908中的文件.

您需要添加一个尾部斜杠,以指示URL中的最后一项是目录而不是文件:
wget -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/

documentation

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 ‘/’).

相关文章

用的openwrt路由器,家里宽带申请了动态公网ip,为了方便把2...
#!/bin/bashcommand1&command2&wait从Shell脚本并行...
1.先查出MAMP下面集成的PHP版本cd/Applications/MAMP/bin/ph...
1、先输入locale-a,查看一下现在已安装的语言2、若不存在如...
BashPerlTclsyntaxdiff1.进制数表示Languagebinaryoctalhexa...
正常安装了k8s后,使用kubect工具后接的命令不能直接tab补全...