Delete invisible files on removable media [duplicate]

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!


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.