Sign up ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

im looking to only grab images from a document with a certain path for example

only grab those with the uploads/number/filename

im currently doing it this way

wget -q -O - | sed -n -e"s%^.*\([0-9][^ \"\']*\.jpg\).*$%\1%p" | xargs wget -q

any other ways of doing this?

thanks in advance

share|improve this question
You could replace wget with curl, that's another way of doing it. Are you looking for a list of alternative operations? That could be quite long. –  Tim Aug 15 '12 at 19:32
@chrismccoy Look at -A/-R options. They're 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. –  rush Aug 15 '12 at 20:36
can the -A allow for paths only uploads/ etc –  chris mccoy Aug 15 '12 at 21:33

1 Answer 1

It would be a little easier to do this:

wget -q -O - \
  | grep -Eo '[0-9]+/[^"]+\.jpg' \
  | wget -i -

As to -A, you can filter jpg files. To filter the path you'd need -I. But it works in recursive mode only so it may download more than you want:

wget -r --level 1 -A jpg -I "/uploads/[0-9]*"


share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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