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”.


Related posts:

  1. Secure Delete Files in Terminal on OS X
  2. Linux copy all hidden files directories keep permissions
  3. Deleting Locked Files in Leopard OS X

Tags: , ,

This works on Linux too. Thanks for the tip.

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

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

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

how do you escape the * character?

Then it is better to use 7 ZIP for extraction…

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

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

Saved my day!
Thanks.

It’s always the little things. Thanks.

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

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

Whoops. Updated. Thanks JT.

Awesome tip. Thanks.

THANK YOU!!