简体   繁体   中英

Wget images from directory

Hey. I have a public directory that contains a number of JPG images. How can I use WGET in 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM