Created
June 7, 2023 22:04
-
-
Save arrowtype/b585c4b1536a4fece9bd50802da96039 to your computer and use it in GitHub Desktop.
A shell function to zip folders, excluding macOS metadata files. Add to your .bash_profile (or similar) to have a "zipit" command.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function zipit { | |
currentDir=$(pwd) # get current dir so you can return later | |
cd $(dirname $1) # change to target’s dir (works better for zip) | |
target=$(basename $1) # get target’s name | |
zip -r $target.zip $target -x '*/.DS_Store' # make a zip of the target, excluding macOS metadata | |
echo "zip made of " $1 # announce completion | |
cd $currentDir # return to where you were | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment