Skip to content

Instantly share code, notes, and snippets.

@lackdaz
Last active July 7, 2021 09:51
Show Gist options
  • Save lackdaz/fa81b9266f7f5108b008d2e486bd6c7a to your computer and use it in GitHub Desktop.
Save lackdaz/fa81b9266f7f5108b008d2e486bd6c7a to your computer and use it in GitHub Desktop.
Removing __MACOSX and .DS_Store artefacts from zip files (MacOSX Only)

Be a better MacOSX Developer

The Problem .DS_Store and __MACOSX files have littered servers, codebases and your colleague's workstations since Apple Inc. decided that MacOSX browsing speeds was more important than the general hygiene of the internet. Here's a cheatsheet to help you clean up after yourself.

Zipping without artefacts

zip -r data.zip . -x ".DS_Store" -x "__MACOSX"

Removing injects from existing zip files

zip -d data.zip "__MACOSX/*" zip -d data.zip "*/.DS_Store"

Removing artefacts from zip files (bulk delete)

for f in *.zip; do zip -d "$f" "__MACOSX/*"; done

for f in *.zip; do zip -d "$f" "*/.DS_Store"; done

I use this a lot on the staging areas right before I upload to my ftp servers.

Read more - Source

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