如何使用 Wget 从 URL 将所有图像下载到单个文件夹中? [英] How do I use Wget to download all images into a single folder, from a URL?
问题描述
我正在使用 wget 从网站下载所有图像,它工作正常,但它存储了站点的原始层次结构以及所有子文件夹,因此图像散布在周围.有没有办法让它只将所有图像下载到一个文件夹中?我目前使用的语法是:
I am using wget to download all images from a website and it works fine but it stores the original hierarchy of the site with all the subfolders and so the images are dotted around. Is there a way so that it will just download all the images into a single folder? The syntax I'm using at the moment is:
wget -r -A jpeg,jpg,bmp,gif,png http://www.somedomain.com
推荐答案
试试这个:
wget -nd -r -P /save/location -A jpeg,jpg,bmp,gif,png http://www.somedomain.com
以下是更多信息:
-nd
阻止创建目录层次结构(即 无目录).
-nd
prevents the creation of a directory hierarchy (i.e. no directories).
-r
启用递归检索.有关详细信息,请参阅递归下载.
-r
enables recursive retrieval. See Recursive Download for more information.
-P
设置保存所有文件和目录的目录前缀.
-P
sets the directory prefix where all files and directories are saved to.
-A
设置白名单以仅检索某些文件类型.接受字符串和模式,两者都可以用在逗号分隔的列表中(如上所示).有关详细信息,请参阅文件类型.
-A
sets a whitelist for retrieving only certain file types. Strings and patterns are accepted, and both can be used in a comma separated list (as seen above). See Types of Files for more information.
这篇关于如何使用 Wget 从 URL 将所有图像下载到单个文件夹中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!