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 phpArchive.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 phpArchive.zip . -i \*.php
Now, if only I would do this often enough so I could remember it without wasting 5 minutes reading the man page.



