Subscribe to our feed

Symfony Experts

Symfony Experts
If you have an urgent question for a symfony-related issue, this is the place to ask.


Stack Overflow

The old fashioned way


March 5, 2009 – 5:44pm Create zip archive from the command line

I never remember how to do this. I like doing it from the terminal better than the “Compress X Items” option in the finder, because the finder method will sometimes add hidden files like __MACOSX which I don’t like seeing floating around.

This is so simple, it’s stupid.

zip [name of archive] [filepattern 1] [filepattern2] ...

So if you wanted to compress all of your PHP files from a directory:

zip *.php

If you want to zip up all the files in the current directory, including files within directories, but still only include files that match a pattern:

zip -r . -i \*.php

Now, if only I would do this often enough so I could remember it without wasting 5 minutes reading the man page.

Posted by in  Uncategorized   |  

Comments are closed.