我有一个web目录,我存储一些配置文件。 我想使用wget将这些文件拉下来并保持当前的结构。 例如,远程目录如下所示:
http://mysite.com/configs/.vim/.vim拥有多个文件和目录。 我想使用wget在客户端上复制。 似乎找不到wget标志的正确组合来完成这一切。 有任何想法吗?
I have a web directory where I store some config files. I'd like to use wget to pull those files down and maintain their current structure. For instance, the remote directory looks like:
http://mysite.com/configs/.vim/.vim holds multiple files and directories. I want to replicate that on the client using wget. Can't seem to find the right combo of wget flags to get this done. Any ideas?
最满意答案
对我来说,我必须传递--no-parent选项,否则它会按照我的站点上的目录索引中的链接到父目录。 所以命令将如下所示:
wget -r --no-parent http://example.com/configs/.vim/编辑1:为避免下载index.html文件,请使用以下命令:
wget -r --no-parent --reject "index.html*" http://example.com/configs/.vim/编辑2:为了避免下载目录结构:
wget -r -nH -nd -np -R index.html* http://example.com/configs/.vim/You have to pass the -np/--no-parent option to wget (in addition to -r/--recursive, of course), otherwise it will follow the link in the directory index on my site to the parent directory. So the command would look like this:
wget --recursive --no-parent http://example.com/configs/.vim/To avoid downloading the auto-generated index.html files, use the -R/--reject option:
wget -r -np -R "index.html*" http://example.com/configs/.vim/更多推荐
发布评论