Get all image files with wget
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?
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/
Use this:
wget -r --level=1 -A.jpg --ignore-length -x -np http://example.com/folder/
What does this do?
-r
: Recursive retrieving (important)--level=0
: Specify recursion maximum depth level. 1 for just this directory.-x
: Force dirs, create an hierarchy of directories even if one would not been created otherwise-np
: no parent, do not ascend to parent dir when retrieving recursively-A.type
: only download files with the extensiontype
.
Source
My pronouns are He / Him