Bash shell script command to zip a directory while excluding some files and folders. This example zips everything in the FOLDER_TO_ZIP
, but excludes the “tests” folder, the “.git” folder, the “README.md” file, and excludes all files ending with “.sh” or “.xml”, and all temporary files with ~
in the name.
This assumes you already set up variables for FOLDER_TO_ZIP
, NEW_ZIP_NAME
and NEWVERSION
.
# zip the $FOLDER_TO_ZIP zip -r ${NEW_ZIP_NAME}.${NEWVERSION}.zip $FOLDER_TO_ZIP -x '*tests*' '*.git*' '*README.md' '*.xml' '*.sh' '*~*'
Questions and Comments are Welcome