Question

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.

Was it helpful?

Solution

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!

OTHER TIPS

Just tried, and this does work in Mavericks (at least for disabling .DS_Store not network shares):

defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true

You just need to remember to restart Finder as well:

killall Finder

The ._ files are AppleDouble files that are used to store metadata like extended attributes, ACLs, file flags, and resource forks.

To delete them, run:

find . -name ._\* -delete

You can see if files have extended attributes, ACLs, or file flags with ls -l@eO. The ._ files are usually created because files have extended attributes. You can use xattr -c to delete extended attributes or chmod -N to delete ACLs. cp -X and rsync copy files without extended attributes, ACLs, file flags, or resource forks.

As you would have to disable writing of hidden files on every Mac that could connect to your share, a better option would be to stop this at the share and not on the clients.

All you need to do is to edit your share config (for example in Linux in /etc/samba/smb.conf) and add the following option into your share config:

veto files = /._*/.DS_Store/ 

Now no Mac clients can save any files with those patterns to your share.

I have not tried this myself, and I realize the OP prefers native solutions, but nonetheless:

There's an app called Asepsis that works by redirecting creation of those files into a special folder, i.e. in a way preventing them from appearing.

Not a native solution, nor does it actually prevent these files being written, but it does actively chase after them & delete as soon as they are written…

BlueHarvest

BlueHarvest automatically removes .DS_Store and ._ AppleDouble files from your USB keys, SD cards, music players, file servers or any non Mac disk. BlueHarvest removes these items as they’re created or modified so you’ll always be metadata free without you needing to lift a finger.

No affiliation, I've just been using it quite successfully for several years.

As far as I know you can not prevent that these files will be created. At least the Finder will create them.

Deleting these files will not help too - because the next time you access the volume and its folders on Mac, the Finder will create them again.

I am astonished that your Windows colleagues see these files. I am working for many years now with my Mac using Mac and Windows - and I never see these files. Neither on Mac nor on Windows.

These files are marked as "hidden" by default, and will not appear if you have Windows set to hide hidden files and folders.

I found a very easy and free way to get rid go ._ files, especially from an external fat32 HD.

Launch OnyX (free software). From Utilities, go to AppleDouble, select... the folder. Thats it!!!

Licensed under: CC-BY-SA with attribution
Not affiliated with apple.stackexchange
scroll top