Here is the command to stop the creation of .DS_Store Directories that pollute your network storage resources. For For Mac OS X Lion you need to use:
defaults write com.apple.desktopservices DSDontWriteNetworkStores true
Now you must Logoff or Restart.
To stop the creation of .AppleDouble folders you need to edit your AFP service configuration. There is usually a « No AppleDouble » or « Enable AppleDouble » configuration setting that needs to be set true (For the NO option) or set to false (For the Enable Option).
Note: In FreeNAS 8.0.4 it seems that the .AppleDouble directories are created anyway regardless of setting. But at least they seem to be empty and can be removed (rm -r /path/).
The Who, What, and When
The .AppleDouble Directories are used by Mac OS X to store Extended Attributes (exattr) for files residing on filesystems that are not formatted HFS+. They are most commonly seen when moving a flash drive from your Mac to your Windows Machine.
The .DS_Store Directories store Finder Information. Such as in « Get File Information » you can access a « Comments » field. If you provide information on the file i the comment it is stored and Finder Information. If this directory is missing on remote storage, other Mac users would not be able to see the comment you created.
Why get rid of them?
On network storage you can have the same share presented over AFP (Apple Filing Protocol) andCIFS (Common Internet File System). Windows users that connect over CIFS can see the extra Apple directories. The files often copy the name of the original file and prefix it with « ._ ». Windows users can mistakenly access these files and think their data is corrupt.