Skip to content

Instantly share code, notes, and snippets.

@jaceshim
Created June 22, 2020 11:45
Show Gist options
  • Save jaceshim/a52233dece3cabaaff4571fd4a300b48 to your computer and use it in GitHub Desktop.
Save jaceshim/a52233dece3cabaaff4571fd4a300b48 to your computer and use it in GitHub Desktop.
zip_without_macosx
#!/bin/bash
for file in */ ; do
if [[ -d "$file" && ! -L "$file" ]]; then
echo "$file is a directory";
zipfile=$(find $file -name *.zip)
rm $zipfile
echo "deleted zipfile to $zipfile"
cd $file
onlyDir="${file%*/}"
echo "onlyDir = ${onlyDir}"
zip -r "${onlyDir}.zip" "${onlyDir}.mp3" -x "*.DS_Store" -x "__MACOSX"
echo "unzip -l ${onlyDir}.zip"
cd ..
fi;
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment