How To Stop The Creation of .DS_Store Files
At the request of a reader, I went ahead and researched what .DS_Store Files are, and how prevent MacOS X from creating them. In a nutshell, .DS_Store files are created by Finder to store preferences:
.DS_Store (Desktop Services Store) is a hidden file created by Apple Inc's Mac OS X operating system to store custom attributes of a folder such as the position of icons or the choice of a background image. By default, Mac OS X will create a .DS_Store file in every folder that it accesses, even folders on remote systems (for example, folders shared over a SMB or AFP connection) and even if the user has only customized the appearance of the folder by moving its Finder window. This is in contrast to the preexisting system for the same purpose used in previous versions of the Macintosh Finder, which would merely place a number of invisible files at the root of the volume being accessed (even on alien filesystems), always storing the settings and metadata for all of the folders in the entire volume within this single set of files.
Unfortunately it seems that you can only prevent Finder from creating these files on network shares and not on your local machine. Here's how you do it:
Open the Terminal application (though I highly recommend using iTerm instead)
Type in the following command
defaults write com.apple.desktopservices DSDontWriteNetworkStores trueand press enter
Reboot your machine so that the changes will take effect
I haven't found a good way to prevent OS X from creating them on local file systems, but perhaps someone out there has some suggestions? Other than creating a script to delete them and adding it to cron, I'm not sure of a way to at least clean them up in an automated fashion. I did run across an application called DS_Store Cleaner which helps clean-up said files, though.