If you're an advanced Mac OS X user, you've undoubtedly come across the .AppleDouble directories and .DS_Store files at some point. Here's a bit of an explanation of their purpose, along with how to delete them and ensure they never return.
.DS_Store, short for Desktop Services Store, is a hidden file similar to the desktop.ini file in Microsoft Windows and stores custom attributes of its containing folder such as the position of icons or the choice of a background image. By default, Finder creates a .DS_Store file in every folder that it accesses, even folders on remote systems shared over an SMB or AFP connection.
.AppleDouble directories contain metadata relating to files similar to the Thumbs.db files in Microsoft Windows. An .AppleDouble directory essentially contains the old Apple "resource fork" metadata and allows Mac OS X to work with formats of disk such as remote NFS, SMB, WebDAV shares or local UFS volumes which do not support resource forks natively. The small binary files within the .AppleDouble directories have the same name as the primary file (formerly the "data fork"), and contain metadata about the file which cannot be stored inside the file itself, such as indexing information.
All of my data backups and shared media are stored on a Linux server running Apple file sharing services. This works great for the most part, but the default setting to create these files on network shares is not particularly useful. You'll need to do two things: First delete them, then stop your Mac from creating them in the first place.
First, a warning: The command shown below recursively erases information beginning with the "current" directory (".") Do not casually use this command unless you full understand the implications and possible data loss. You are responsible for your own actions.
The following line removes all '.DS_Store' files from the current directory on down.
$ find . -name '.DS_Store' -type f -ls -and -exec rm -rv {} +
The following line RECURSIVELY removes all '.AppleDouble' directories from the current directory on down.
$ find . -name '.AppleDouble' -type d -ls -and -exec rm -rv {} +
I recommend you test the two previous commands in a "sandboxed" manner, such as from a sub-directory somewhere on the shared volume. Then you can cd to the root of the share and wipe all unwanted files.
If you're not using Netatalk 3.x, you should be. Configuration has changed significantly since version 2, and these steps only apply to version 3.x
First, edit your afp.conf file. This is typically located in /usr/local/etc. You'll need su access:
$ sudo vi /usr/local/etc/afp.conf
In the [Global] section, add the following line:
[Global]
appledouble = ea
Then, under each of your afp shares, add the following line. You could also do this in the [Global] section above if you want to prevent the creation of .AppleDouble files in all shared mounts.
ea = none
ea stands for extended attributes, which are stored in the .AppleDouble directory tree. setting to none should disable the creation of these directory structures altogether.
The last step has to be done on your Mac. If you have multiple Macs accessing the network share, you'll have to run these commands on all of them.
$ defaults write com.apple.desktopservices DSDontWriteNetworkStores true
You may need sudo for the above to work. Logout or restart your Mac to finalize the changes.