# Ubuntu – Get all image files with wget

command linewget

I am trying to download all the image file in a folder. I tried

wget -r  https://example.com/


And

wget https://example.com/*.jpg


These didn't work. Can anyone guide?

#### Best Answer

If a target web server has directory indexing enabled, and all the files to download are located in the same directory, you can download all of them, by using wget's recursive retrieval option.

use

wget -r -l1 -A.jpg http://www.example.com/test/


it will download all .jpg file from directory test.

if you don't want to download all file then the infos below will be helpful.

   -A acclist --accept acclist
-R rejlist --reject rejlist
Specify comma-separated lists of file name suffixes or patterns to
accept or reject. 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.

--accept-regex urlregex
--reject-regex urlregex
Specify a regular expression to accept or reject the complete URL.


like :

wget -r --no-parent -A '*.jpg' http://example.com/test/