Skip to content

Instantly share code, notes, and snippets.

@premitheme
Last active April 30, 2022 16:54
Show Gist options
  • Save premitheme/7303d4df498e3190426f8b7948e4062f to your computer and use it in GitHub Desktop.
Save premitheme/7303d4df498e3190426f8b7948e4062f to your computer and use it in GitHub Desktop.
Create automator service to clean zip files

Clean Zip Service for Mac

In Automator create new workflow with the following settings

Service recieves selected: files or folders in: Finder.app

Run Shell Script

Shell: /bin/bash Pass input: to stdin

while read -r p; do
  zip -d "$p" "__MACOSX/*" || true
  zip -d "$p" "*.DS_Store" || true
  zip -d "$p" "*.git/*" || true
  zip -d "$p" "*.gitignore" || true
  zip -d "$p" "*.sass-cache/*" || true
  zip -d "$p" "*.codekit-cache/*" || true
  zip -d "$p" "*.codekit" || true
  zip -d "$p" "*.codekit3" || true
done

Then save this as service with the name "Clean Zip".

To clean any zip file, right click on it, go to services -> Clean Zip.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment