Skip to content

Instantly share code, notes, and snippets.

@mehedidb
Created October 10, 2023 08:09
Show Gist options
  • Save mehedidb/82ea609ab6acb7cbd7fc4f148fe5d5ce to your computer and use it in GitHub Desktop.
Save mehedidb/82ea609ab6acb7cbd7fc4f148fe5d5ce to your computer and use it in GitHub Desktop.
Create zip files cleaner for mac 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
while read -r p; do
  zip -d "$p" __MACOSX/\* || true
  zip -d "$p" \*/.DS_Store || true
  zip -d "$p" \*/.git/\* || true
  zip -d "$p" \*/prepros.config || true
  zip -d "$p" \*/_Changelog.html || true
  zip -d "$p" \*/_Description.html || true
  zip -d "$p" \*/_Features.html || true
  zip -d "$p" \*/_Upcoming.html || 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