Skip to content

Instantly share code, notes, and snippets.

@jsteenkamp
Last active August 29, 2015 14:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jsteenkamp/3eaf62895cf69c77b865 to your computer and use it in GitHub Desktop.
Save jsteenkamp/3eaf62895cf69c77b865 to your computer and use it in GitHub Desktop.
OSX bash function and alias to remove hidden directories from zip files
$ nano ~/.bash_rc
function dsclean() {
if [ -f $1 ]
then
echo "Delete __MACOSX folder from $1"
zip -d "$1" __MACOSX*
echo "Delete all .DS_Store folders from $1"
zip -d "$1" \*.DS_Store
fi
}
-----
$ nano ~/.bash_profile
if [ -f ~/.bash_rc ]
then . ~/.bash_rc
fi
alias dsclean='dsclean';
@jsteenkamp
Copy link
Author

Run from terminal and specify the zip file to process:

$ dsclean files.zip

You can also use OSX apps like Keka and YemuZip

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