Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/bash/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Bash wget无法使用--include获取4级目录_Bash_Wget - Fatal编程技术网

Bash wget无法使用--include获取4级目录

Bash wget无法使用--include获取4级目录,bash,wget,Bash,Wget,现在我正在尝试创建一个脚本。其中,根据输入下载一组目录 比如说- wget -r -nH --cut-dirs=2 --no-parent --reject "index.html*" \ --include-directories 'apache/hadoop/common/' \ http://mirrors.estointernet.in/apache/hadoop/ 这很好用 但是当我试图在路径中添加一个级别时,从apache/hadoop/comm

现在我正在尝试创建一个脚本。其中,根据输入下载一组目录

比如说-

wget -r -nH --cut-dirs=2 --no-parent --reject "index.html*" \
    --include-directories 'apache/hadoop/common/'           \
    http://mirrors.estointernet.in/apache/hadoop/
这很好用

但是当我试图在路径中添加一个级别时,从
apache/hadoop/common/
apache/hadoop/common/current/

wget -r -nH --cut-dirs=2 --no-parent --reject "index.html*" \
    --include-directories 'apache/hadoop/common/current/'   \
    http://mirrors.estointernet.in/apache/hadoop/
它不起作用了


有什么办法可以做到这一点吗?

您需要调整从中下载的URL。试试这个:

wget -r -nH --cut-dirs=2 --no-parent --reject "index.html*" \
    --include-directories 'apache/hadoop/common/current/'   \
    http://mirrors.estointernet.in/apache/hadoop/common/current
原始命令不起作用的原因是wget下载
http://mirrors.estointernet.in/apache/hadoop/index.html
其中包含:

<html>
<head><title>Index of /apache/hadoop/</title></head>
<body bgcolor="white">
<h1>Index of /apache/hadoop/</h1><hr><pre><a href="../">../</a>
<a href="common/">common/</a>                                            20-Nov-2018 03:24                   -
<a href="core/">core/</a>                                              20-Nov-2018 03:24                   -
<a href="ozone/">ozone/</a>                                             19-Nov-2018 20:22                   -
</pre><hr></body>
</html>

这些链接中没有一个与“apache/hadoop/common/current/”include directories参数匹配,因此它退出。

Stack Overflow是一个用于编程和开发问题的站点。如果没有更多信息,这是不可能的。你使用的两个URL是什么?@ JWW,你不认为shell脚本是一种编程语言吗?”达尔尼尔用例子来更新问题。伙计们,请给出原因,为什么你已经否决了这个问题?这很有趣。根据你的回答,我必须改变我的来源。还有别的办法吗?我不知道。
/apache
/apache/hadoop/common
/apache/hadoop/core
/apache/hadoop/ozone