Compressing folders on a mac, without the .DS_Store

Is there anyway to get rid of the .DS_Store when compressing a folder on a mac?

I work on a mac and send work to clients in zip format, but always get questioned on the .DS_Store folder inside them. It seems to be unavoidable unless I open the folder on Windows then delete the .DS_Store and compress it there. It is quite a big hassle.

Are there any easy work arounds?


If you do not mind jumping down in to terminal, then this is pretty darn easy. If you are in /Users/username, which is your $HOME directory and there is a subdirectory named foo that you want to zip but ignore all .DS_Store files, then do the following:

zip -r foo.zip foo -x "*.DS_Store"

To interpret this, we are running the zip executable with the following parameters/arguments:

  • -r for recursively including all directories underneath the targets we want to zip.
  • foo.zip is the name of the zip archive we are creating
  • foo is the target directory we want to zip up
  • -x "*.DS_Store" excludes all files whose path ends in the string ".DS_Store"

No goofy third party applications needed nor do you need to trash your .DS_Store files at all - just rely on all of the unix tool goodness built right in to OSX / Darwin.


You can create an automator application that accepts a folder as input and produces a zip file of the folder contents without any cruft.

Store this application in /Users/you/Applications and then drag it into your finder toolbar. Then you can drag folders onto the app from any finder window.

Create an automator application

Add 'get selected finder items' step. And also add a 'run shell script' step with the 'Pass input' option set to 'as arguments'.

Add workflow steps

The script:

name=("$@")
cd "$name"
zipFileName=`basename "$name"`
zip "${zipFileName}.zip" -r ./* \
    -x */.DS_Store \
    -x */.git \
    -x */.svn \
    -x */.idea \
    -X */__MACOSX
mv "${zipFileName}.zip" ../

Accepts a folder as input and produces a zipfile with the name of the folder.