I'm working in a directory that looks like this:


During work on this project I very regularly have to zip up the contents of this folder with the exception of Archive.zip and the .git directory (the new zipped folder needs to replace the previous Archive.zip file).

I am doing this by shift-selecting the appropriate files > right clicking > compressing . This is not as efficient as it could be.

Is it possible to use the zip command from the command line to accomplish this? Or would I be better off writing a custom command to do this?


run from that directory:

rm Archive.zip; zip Archive.zip -r . --exclude '.git/*'

rm will remove old Archive.zip (you need to do that, or zip will just UPDATE the current content of Archive.zip); zip -r . will add all directories and folders recursively, and --exclude '.git/*' will exclude given directories.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.