2017-02-24 60 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/ 
相关问题