MacOS – Disable storage of invisible files “._” on the cfs or smb network storage

filesysteminvisible-filesmacossmb

I use OS X Mavericks and have some company storage drives mounted (using smb or cfs).
(smb://username@address.path.toserver.com/directory/data).
When I work with files on the drive or copy files to the drive, some hidden files are created. Most of these files start with dot-dash ._ and then the filename of the original file, like:

._test001.png
._test002.png
._test003.png

And most of the times, the famous ._.DS_Store and .DS_Store are also there.

On my Mac, these . dot items are invisible, but my windows colleagues do see these files. How can I prevent OS X from making these strange invisible files?

On support.apple.com (and other internet sources) you can find a 'defaults write' to disable the creation of .DS_Store files on your network drives. But this does not work in Mavericks:

defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true

For now I use this oneliner, but doing a rm -rf does feel wrong in this case.

find . -type f -name "._*" -exec rm "{}" \;

Edit: I don't want to delete the files or exclude them from copying. I want them not to be created in the first place.

Edit: I prefer a 'native' OS X solution over third party apps.

Edit: This questions has two answers, one for the ._ files and one for the .DS_Store files. The bounty is rewarded for dot_clean, this native command line app cleans all ._ files. Unfortunately is does not clear the .DS_Store files, this can effectively be done with Asepsis. Asepsis stores .DS_Stores in a fixed location, and not in the folder itself.

Best Answer

I will admit, I hadn't noticed that the defaults write command stopped working in Mavericks. However, when I DO clean network mounts, instead of your one liner find and rm, I use this:

dot_clean .

The manfile explains:

dot_clean -- Merge ._* files with corresponding native files.

I don't use the -m flag, but you may find it helpful in your situation.

-m      Always delete dot underbar files.

Here is another person actively trying to stop .DS_Store files from being created: http://www.aorensoftware.com/blog/2011/12/24/death-to-ds_store/ - looks like he doesn't want them on drives as much as he doesn't want them on the network!