Home > News

News

News Archive for September 2005

Creating Clean Archives in OS X

September 26, 2005/ — It's easy to create an archive of a directory in OS X -- just Control-Click on the directory you want to archive and choose "Create Archive of [Directory]".

If you have to share the archive with users of other operating systems, however, some problems arise. All of the ".DS_Store" files that the Finder keeps in each directory end up in the archive. Also, OS X creates another superfluous directory called "_MACOSX" inside the archive (this directory apparently contains metadata). So what looks to you like a nice clean archive is full of OS X artifacts when it's opened in Windows.

It's possible to create clean archives in OS X from the command line. I do it as a two step process, but it could easily be shell scripted.

The first step is to remove all of the ".DS_Store" files from the directory you want to archive. Let's call the directory "foo". From within foo's parent directory, in Terminal, run:

> sudo find foo/ -name ".DS_Store" -depth -exec rm {} \;

(This comes from a Dreamweaver TechNote on the Macromedia website.)

The second step is to create the archive. To create an archive called bar.zip of foo and all its subdirectories, run (still from foo's parent directory):

> zip -r bar.zip foo/

That should create bar.zip, a nice clean archive of foo and all its subdirectories without all the OS X artifacts.

News Archive List