如何下载包含所有文件和子目录的 HTTP 目录,因为它们出现在在线文件/文件夹列表中? [英] How to download HTTP directory with all files and sub-directories as they appear on the online files/folders list?
问题描述
有一个我可以访问的在线 HTTP 目录.我尝试通过 wget
下载所有子目录和文件.但是,问题是当 wget
下载子目录时,它会下载 index.html
文件,该文件包含该目录中的文件列表,而无需下载文件本身.>
有没有什么方法可以无深度限制下载子目录和文件(好像我要下载的目录只是我想复制到我电脑的文件夹).
解决方案:
wget -r -np -nH --cut-dirs=3 -R index.html http://hostname/aaa/bbb/ccc/ddd/
说明:
- 它会下载ddd目录下的所有文件和子文件夹
-r
: 递归-np
: 不去上层目录,比如 ccc/...-nH
: 不将文件保存到主机名文件夹--cut-dirs=3
:但通过省略将其保存到 ddd前 3 个文件夹 aaa、bbb、ccc-R index.html
: 排除 index.html文件
There is an online HTTP directory that I have access to. I have tried to download all sub-directories and files via wget
. But, the problem is that when wget
downloads sub-directories it downloads the index.html
file which contains the list of files in that directory without downloading the files themselves.
Is there a way to download the sub-directories and files without depth limit (as if the directory I want to download is just a folder which I want to copy to my computer).
Solution:
wget -r -np -nH --cut-dirs=3 -R index.html http://hostname/aaa/bbb/ccc/ddd/
Explanation:
- It will download all files and subfolders in ddd directory
-r
: recursively-np
: not going to upper directories, like ccc/…-nH
: not saving files to hostname folder--cut-dirs=3
: but saving it to ddd by omitting first 3 folders aaa, bbb, ccc-R index.html
: excluding index.html files
这篇关于如何下载包含所有文件和子目录的 HTTP 目录,因为它们出现在在线文件/文件夹列表中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!