Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am having a problem with wget and accept patterns.

What I want to do is only download files which match the pattern


I am using the command

wget -r -A "\*/images/src/test\*.jpg"

For some reason the pattern will not work with slashes in it.

\*test\*.jpg works great, but as soon as there's a forward slash in there it fails! I know wget uses the shell's pattern matching, but slashes should work, somehow they do not though.

Any ideas?

share|improve this question

I believe the accept/reject patterns specified with the -A/-R switches are only matched against the filename portion of the URL, in other words the part after the last slash. The info documentation describes it as follows:

Finally, it's worth noting that the accept/reject lists are matched
twice against downloaded files: once against the URL's filename
portion, to determine if the file should be downloaded in the first
place; then, after it has been accepted and successfully downloaded,
the local file's name is also checked against the accept/reject lists
to see if it should be removed.

There are separate switches (-I/-X) which specify patterns to match against the directory part of the URL but as far as I can see there is nothing which matches against the whole path including both the directory and the filename.

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.