开发者

Wget images from directory

开发者 https://www.devze.com 2023-02-02 09:04 出处:网络
Hey. I have a public directory that contains a number of JPG images. How can I use WGET in 开发者_StackOverflow中文版order to download each picture into a specific directory on my local machine? than

Hey. I have a public directory that contains a number of JPG images. How can I use WGET in 开发者_StackOverflow中文版order to download each picture into a specific directory on my local machine? thanks


wget -r --directory-prefix=/path/to/save/to -A jpg www.example.com/path/to/image/directory

All from the wget manual

The -A argument allows you to specify the file name suffixes that you care about (there's also a similar -R to exclude files):

-r is recursive retrieval, so it will go into subdirectories.

--directory-prefix=/path specifies where to save to.

And the -A flag, I'll cut a snippet from the manual:

-A acclist --accept acclist

-R rejlist --reject rejlist

Specify comma-separated lists of file name suffixes or patterns to accept or reject (see Types of Files). Note that if any of the wildcard characters, ‘*’, ‘?’, ‘[’ or ‘]’, appear in an element of acclist or rejlist, it will be treated as a pattern, rather than a suffix.


First of, ensure you have directory listing on your server (not a good setting imho). Next, make wget get this listing, parse it somehow and finally wget each image.

0

精彩评论

暂无评论...
验证码 换一张
取 消