18

Is there a way to disable the creation of .AppleDouble files in Mac OS X (Snow Leopard) on non-HFS filesystems (such as SMB or NFS network shares etc...) ?

  • 1
    Please provide more information. They aren't usually created on HFS+. – Daniel Beck Jul 4 '11 at 13:30
7

Given that Macs support multiple forks to files, the AppleDouble trick (._ files) try to preserve the data in those forks. So they are needed so that Mac OS X can perform operations on them.

However, most of the files are created when the same volume is mounted through AFP, not SMB/CIFS or NFS. In that case, the AFP server might have configuration options for dealing with the Apple Double files (see, for instance, this blog post).

In order to get rid of AppleDouble files, you can on a Mac the dot_clean command:

dot_clean --keep=dotbar /Volumes/mounted_smb_volume

where mounted_smb_volume would be the name of the mounted volume.

You could add it to a crontab entry, or better yet, use something like Lingon X to create a launchd entry.

  • Did this work for you, @Bart? You could consider marking it as the right solution 😉 – juandesant Jul 27 '16 at 14:59
  • I used this on an SD card and the contents cannot be viewed with Finder anymore, only visible in terminal with ls. – FRIdSUN Mar 21 '17 at 12:12
  • @FridSUN, try to eject and mount the volume again, it does not make any sense they keep invisible in the Finder… unless you have files that start with dot (.), or you have marked that volume as invisible. – juandesant Mar 24 '17 at 13:30
  • The question is about files called .AppleDouble, not files starting ._ – OrangeDog Sep 28 '18 at 9:50
  • AppleDouble is an encoding for metadata, @OrangeDog; see for instance icesquare.com/wordpress/how-to-remove-ds_store-and-appledouble AppleDouble encoded metadata are in the form of ._ files. – juandesant Oct 2 '18 at 23:04
4

http://support.apple.com/kb/HT1629 tells me that this can be done via

To configure a Mac OS X user account so that .DS_Store files are not created when interacting with a remote file server using the Finder, follow the steps below:

Note: This will affect the user's interactions with SMB/CIFS, AFP, NFS, and WebDAV servers.

Open Terminal.
Execute this command:

defaults write com.apple.desktopservices DSDontWriteNetworkStores true

Either restart the computer or log out and back in to the user account.
  • 3
    Doesn't seem to work for .AppleDouble files. – Adam Lindberg Jul 13 '12 at 14:26
  • 4
    This definitely only applies to .DS_Store and not to .AppleDouble. – Asher Dec 26 '12 at 18:22
2

AppleDouble files (the ones named ._filename) are created when you copy a file containing a resource fork to a non-HFS file system.

Sometimes (but not always) the resource you can manage without the resource fork data - for example copying an mp3 file.

You can suppress the resource fork copying if you use a shell (not finder) by using:

cp -X
  • 2
    This is not a general solution. – Adam Lindberg Jul 13 '12 at 14:26
  • To clarify why this is not a general solution, this only applies when manually copying files from the command line. This is unlikely to have any relation to the problem, as .AppleDouble files are created any time a file is accessed on a non-HFS+ volume. Even if you could copy without the resource fork, that only addresses a special case and not the general issue of wanting no .AppleDouble files. – Asher Dec 26 '12 at 18:23
  • The question is about files called .AppleDouble, not files starting ._ – OrangeDog Sep 28 '18 at 9:51
1

You can use BlueHarvest to automatically delete AppleDouble files or other files created by OS X:

You can use find . -name ._\* -delete to delete ._ files recursively under the current directory. dot_clean -m . also has the same effect.

The files that start with ._ are used to store metadata like extended attributes and ACLs. Extended attributes include resource forks (com.apple.ResourceFork) and file flags (com.apple.FinderInfo). You can see extended attributes with xattr -l or ACLs with ls -le. You can use xattr -c to clear all extended attributes or chmod -N to delete ACLs, and you can copy files without extended attributes with cp -X.

1

There is a tool called "dsweeper" available here: https://github.com/simsalabim/dsweeper It solves the problem (once installed) with a simple

$ dsweeper -d -p /Path/to/volume/

From the website:

A tool that doesn't let AppleDouble ._whatever files into folder that is kept on external HDD. Helps keeping Dropbox clean.

Via homebrew, the installation is remarkably simple:

$ brew install npm

$ npm install dsweeper -g

Solved the problem for me like a charm.

-1

I think part of the question is: why do you want to eliminate .AppleDouble files?

.AppleDouble files are created to store additional file resources (meta-data, etc.). HFS+ filesystems (designed by Apple) have native means to address the storage of this information. Non-HFS+ filesystems (NTFS, EXT3/4, etc.) served over filesharing (Netatalk, SMB, etc.) require some way to store this information. This is achieved by creating additional files on the filesystem, since the filesystem does not have native means for storing the information.

Unlike .DS_Store files (which, as I understand, store desktop details such as icon location, etc.), .AppleDouble files actually store potentially relevant information. This means that you can probably delete the .AppleDouble files and the OS won't complain, but you may well lose meta-data if any is associated with the file. This also includes meta-data created by/for Spotlight, such as when iTunes plays a file. Deleting this information is unlikely to hurt anything, but it is being created/stored for you so that the OS can optimize search and other terms.

So my conclusion is that you probably don't actually want to delete .AppleDouble. But perhaps the details can be filled in? I arrived at this thread attempting to help my Dad with two ReadyNAS; he wanted to eliminate the files because their existence was inexplicable and causing strange behavior with the ReadyNAS backup program (which seems to be solved by using rsync). Please let me know if there are further details not addressed in my conclusions here.

  • 2
    My reason is that these .AppleDouble folders in directories on my NAS prevent my Windows machines from deleting those directories. Having to log into the NAS and use the web based file browser is really annoying. – Simon Gill Jan 20 '13 at 4:58
  • I've down voted this because I believe it contains some misinformation. Apparently no non HFS+ File-systems can store metadata? This is incorrect, NTFS does support file metadata, its just that Apple does not interact with it correctly and instead creates a basic file. – leinad13 Sep 25 '13 at 14:50
  • 2
    My reason is that my car stereo tries to play ._XYZ.MP3 files from my USB stick (FAT32), and complains fiercely. So I've came up with a little AppleScript to remove the ._ files when ejecting the volume. – Joe Völker Jan 22 '15 at 4:12
  • NTFS doesn't support Apple's metadata and Apple doesn't write to NTFS's metadata. The result is that the description in the original answer is accurate. "Misinformation" is only from misconstruing what "this" refers to and assuming it refers to metadata as such. – Asher Sep 27 '16 at 20:02

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.