Unzip and flatten multiple zip-files on a Mac (bash)

Here’s just a quick note to my future self (other people are free to take part of it too though).

When using the * character to unzip several files using the unzip command on a Mac, the * has to be escaped as unzip wants to do its file listing by itself, rather than having bash do it for it.

So instead of writing unzip *.zip, you would write \*.zip.

Also as a final note to self, to unzip several zip-files into e.g. the parent directory and also ignore any directory structure contained by the zip file + overwriting any duplicate files, one would write

unzip -o -j -d ../ \*.zip
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s