简体   繁体   English

使用wget下载目录

[英]using wget to download a directory

I'm trying to download all the files in an online directory. 我正在尝试下载在线目录中的所有文件。 The command I'm using is: 我正在使用的命令是:

wget -r -np -nH -R index.html http://www.oecd-nea.org/dbforms/data/eva/evatapes/mendl_2/

Using this command I get an empty directory. 使用此命令,我得到一个空目录。 If I specify file names at the end I can get one at a time, but I'd like to get them all at once. 如果我在末尾指定文件名,则一次只能获得一个,但是我想一次全部获得它们。 Am I just missing something simple? 我只是想念一些简单的东西吗?

output from command: 命令输出:

--2015-03-14 14:54:05-- http://www.oecd-nea.org/dbforms/data/evaevatapes/mendl_2/ Resolving www.oecd-nea.org... 193.51.64.80 Connecting to www.oecd-nea.org|193.51.64.80|:80... connected. --2015-03-14 14:54:05-- http://www.oecd-nea.org/dbforms/data/evaevatapes/mendl_2/解析www.oecd-nea.org ... 193.51.64.80连接到www.oecd-nea.org | 193.51.64.80 |:80 ...已连接。 HTTP request sent, awaiting response... 200 OK Length: unspecified [text/html] Saving to: âdbforms/data/eva/evatapes/mendl_2/index.htmlâdbforms/data/eva/evatapes/mendl_2/index.htmlârobots.txtârobots.txt 已发送HTTP请求,正在等待响应... 200 OK长度:未指定[text / html]保存到:dbforms / data / eva / evatapes / mendl_2 /index.htmlâdbforms/ data / eva / evatapes / mendl_2 /index.htmlârobots.txtârobots。文本

Add the depth of links you want to follow ( -l1 , since you only want to follow one link): 添加您要关注的链接的深度( -l1 ,因为您只想关注一个链接):

wget -e robots=off -l1 -r -np -nH -R index.html http://www.oecd-nea.org/dbforms/data/eva/evatapes/mendl_2/

I also added -e robots=off , since there is a robots.txt which would normally stop wget from going through that directory. 我还添加了-e robots=off ,因为有一个robots.txt通常可以阻止wget通过该目录。 For the rest of the world: 对于世界其他地区:

  • -r recursive, -r递归
  • -np no parent directory -np没有父目录
  • -nH no spanning across hosts -nH不跨越主机

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM