2017-02-24 48 views
1

我有一個網站:http://www.example.com/如何從所有孫子目錄wget的文件

這個網站有一個子目錄:http://www.example.com/images/

該子目錄包含它們的內部與圖像衆多子目錄:

當我嘗試從images目錄wget,它下載每個目錄(01/02/等)和index.html每一個的內部。它不下載任何圖像。例如

wget -r http://www.example.com/images/ < - 不下載的PNG

wget -r http://www.example.com/images/01/ < - 不下載的PNG

如何使用wget下載所有從images/目錄下的所有子目錄png•不用通過每個子目錄中去(01 /,02 /,03 /等)一個接一個?

+1

是的,幫助。謝謝! – Aaron

回答

1

您只需要按照您的要求查看man wget以查找選項。隨着快速查找,我發現這些,

-A acclist --accept acclist   
     Specify comma-separated lists of file name suffixes or patterns to 
     accept or reject. 

--no-directories 
     Do not create a hierarchy of directories when retrieving recursively. 
     With this option turned on, all files will get saved to the current directory, 
     without clobbering (if a name shows up more than once, the filenames will get extensions .n). 

Recursive Retrieval Options 
-r 
--recursive 
     Turn on recursive retrieving. The default maximum depth is 5. 

結合這些結合在一起,你可以把一個命令

wget -nd -r -A png http://www.example.com/images/ 
相關問題