16

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?

19

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/
| improve this answer | |
6

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 extension type.

Source

My pronouns are He / Him

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.