How to Exclude Files When Zip in macOS

When using macOS zip tool from the command, you may want to exclude certain files by name or extensions. I often need to do this when automating extension bundles for a release. Here is the command I use to exclude __MACOSX and DS_Store files that macOS creates.

zip -r deploy.zip . -x ".\*" -x "\_\_MACOSX" -x "*DS_Store"

The -x flag exlcudes files that match the pattern. Here is a list of other options for the zip command line tool.


Thanks for reading. Make sure you follow me on Twitter to stay up to date on the progress of my side projects T.LYWeather Extension, and Link Shortener Extension. If you are interested in the tech I use daily, check out my uses page.  

Leave a Reply

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