Directory

wget不遞歸下載文件

  • April 16, 2019

我在這個網站上看到了一些關於如何以遞歸方式從目錄下載文件的文章。所以,我執行了以下行:

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)

網路目錄包含很多tar.bz2文件。誰能告訴我哪裡出錯了?

我的 wget 版本是1.16.3

似乎通過 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

引用自:https://unix.stackexchange.com/questions/293283