wget 不递归下载文件

wget 不递归下载文件

我在这个网站上看到了一些关于如何从目录递归下载文件的帖子。所以,我执行了以下行:

wget -r -nH --cut-dirs=3 -A '*.bz2' -np http://www.xfce.org/archive/xfce-4.6.2/src/

它只下载索引页,然后自动删除。

输出:

--2016-07-01 16:56:02--  http://www.xfce.org/archive/xfce-4.6.2/src/
Resolving www.xfce.org (www.xfce.org)... 138.48.2.103
Connecting to www.xfce.org (www.xfce.org)|138.48.2.103|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: http://archive.xfce.org/xfce/4.6.2/src/ [following]
--2016-07-01 16:56:17--  http://archive.xfce.org/xfce/4.6.2/src/
Resolving archive.xfce.org (archive.xfce.org)... 138.48.2.107
Connecting to archive.xfce.org (archive.xfce.org)|138.48.2.107|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: ‘index.html’

index.html                                [ <=>                                                                      ]   8.05K  --.-KB/s   in 0.03s  

2016-07-01 16:56:23 (247 KB/s) - ‘index.html’ saved [8239]

Removing index.html since it should be rejected.

FINISHED --2016-07-01 16:56:23--
Total wall clock time: 21s
Downloaded: 1 files, 8.0K in 0.03s (247 KB/s)

Web 目录包含很多tar.bz2文件。谁能告诉我哪里错了?

我的 wget 版本是1.16.3

答案1

看起来通过 http 获取目录列表并不简单;我可以bz2使用以下方式获取文件:

wget -k -l 0 "http://archive.xfce.org/xfce/4.6.2/src/" -O index.html ; cat index.html | grep -o 'http://archive.xfce.org/xfce/4.6.2/src/[^"]*.bz2' | uniq -c | xargs wget

相关内容