Advertisement

Removing .DS_Store files from archives

The marvelous Shaun T. Erickson tipped me off on a sweet way to remove .DS_Store files from your folders before you archive them. Those are the "invisible" files added by Finder on your Mac. He writes that it doesn't matter whether you zip or tar: if they are in the directory tree, they get picked up by the archive. He suggests running the following command from terminal, substituting the appropriate directory for "your_dir":

find your_dir -type f -name .DS_Store -print0 | xargs -0 rm

After, just tar or zip up your tree.