Caution filename not matched when unzipping multiple files

Fix for “caution: filename not matched” error when trying to unzip multiple files at once in Terminal.

Solution for unzipping multiple zip files with a single command.

Open up a Terminal window on OS X, go to the directory containing the zip files and enter this command:

unzip *.zip

The backslash escapes (prevents) the wildcard character (the “*”) from being expanded by bash shell interpreter. In English: the files in the directory are the filenames “unzip” is trying to extract from the first file it finds when using “*”.

Example:

/myzips directory contains zip files: first.zip second.zip third.zip

Trying to run: “unzip *.zip” will cause the unzip program to take “first.zip” as the archive to play with, and will look for files “second.zip” and “third.zip” within “first.zip” to expand/extract. Obviously not what you want to do.

Not escaping the * character will result in errors like: “caution: filename not matched”.


Posted

in

,

by

Comments

17 responses to “Caution filename not matched when unzipping multiple files”

  1. Peezee Avatar
    Peezee

    This works on Linux too. Thanks for the tip.

  2. Ben Lam Avatar
    Ben Lam

    Lucky for us, BSD, the base of Mac OS X, has many similarities to Linux.

  3. […] Follow this link: Caution filename not matched when unzipping multiple files | Mac OS X Leopard & Tiger Dual Boot […]

  4. Shaun Avatar
    Shaun

    Thanks for the tip. Helped me out on Snow Leopard.

  5. Uncle Ben Avatar
    Uncle Ben

    Thanks! I always wondered why “unzip *.zip” didn’t work (as it would in a good ol’ dos box :-D). Cheers.

  6. What should I do if I get a “caution: filename not matched” error when trying to unzip multiple files at once in Terminal?…

    Thanks for the softball question.

    From: http://installingcats.com/2008/05/23/caution-filename-not-matched-unzipping-multiple-files/ :

    unzip *.zip

    “Trying to run: “unzip *.zip” will cause the unzip program to take “first.zip” as the archive to pla…

  7. Eric Avatar

    how do you escape the * character?

  8. SEO LABS Avatar

    Then it is better to use 7 ZIP for extraction…

  9. Amy Avatar

    Finally a reason to why I have been getting this freaking message: “caution: filename not matched”. Thanks for a solution.

  10. Sam Avatar

    This is a good little command to have. I’ve run into many problems with zip files.

  11. Fernando Avatar
    Fernando

    Saved my day!
    Thanks.

  12. Jason McCreary Avatar

    It’s always the little things. Thanks.

  13. Nutela Avatar
    Nutela

    Why does it do that? Isn’t that a bug?

  14. JT Avatar
    JT

    Thanks. Excellent, except that what you called a forward slash is actually a back slash. http://en.wikipedia.org/wiki/Backslash

  15. Ben Lam Avatar
    Ben Lam

    Whoops. Updated. Thanks JT.

  16. jonny Avatar
    jonny

    Awesome tip. Thanks.

  17. pablo Avatar
    pablo

    THANK YOU!!

Leave a Reply

Your email address will not be published. Required fields are marked *