Is there a Wget command that will allow me to download all jpegs that include the following url:


So all jpegs under that particular url will be downloaded, such as the following:

Regardless of whether the jpegs have different naming conventions.

  • wget -A jpg -r http://www.sample.com/images/imag/
    – Costas
    Jan 13, 2015 at 23:05

2 Answers 2


wget -r -A jpg,jpeg http://www.sample.com/images/imag/

This will create the entire directory tree. If you don't want a directory tree, use:

wget -r -A jpg,jpeg -nd http://www.sample.com/images/imag

Alternatively, connect to sample.com (e.g. via ssh) and locate the /images/imag folder ls *.jp* > foo.txt, wget -i -F foo.txt -B http://www.sample.com/images/imag/foo.jpg.


Depends on how you "get" http://www.sample.com/images/imag/ image list.

If it is a page that include the images in a HTML document you could try something like this:

wget -nd -p -A jpg,jpeg -e robots=off http://...


  • -nd : No directories. --no-directories
  • -p : Include images (Page requisites) --page-requisites
  • -A : Comma separated list of file name suffixes or patterns to accept. --accept
  • -e : Execute command as if part of .wgetrc. --execute
    • Here; robots=off

Some servers only delivers compressed HTML, i.e. gzip. Then you have to take some extra measures as wget won't unpack and parse these (AFAIK). A rather quick and painless solution is using Privoxy.

After install make wget use the proxy by:

export http_proxy="http://localhost:8118"

then run command again.

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.