Disable creation of .AppleDouble files on Mac OS X

19

6

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...) ?

Bart

Posted 2011-07-04T13:14:38.143

Reputation: 289

1Please provide more information. They aren't usually created on HFS+. – Daniel Beck – 2011-07-04T13:30:33.833

Answers

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.

juandesant

Posted 2011-07-04T13:14:38.143

Reputation: 233

Did this work for you, @Bart? You could consider marking it as the right solution – juandesant – 2016-07-27T14:59:03.613

I used this on an SD card and the contents cannot be viewed with Finder anymore, only visible in terminal with ls. – FRIdSUN – 2017-03-21T12:12:40.677

@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 – 2017-03-24T13:30:33.213

The question is about files called .AppleDouble, not files starting ._ – OrangeDog – 2018-09-28T09:50:52.553

AppleDouble is an encoding for metadata, @OrangeDog; see for instance https://icesquare.com/wordpress/how-to-remove-ds_store-and-appledouble/ AppleDouble encoded metadata are in the form of ._ files.

– juandesant – 2018-10-02T23:04:45.247

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.

Layticia

Posted 2011-07-04T13:14:38.143

Reputation: 458

3Doesn't seem to work for .AppleDouble files. – Adam Lindberg – 2012-07-13T14:26:21.713

4This definitely only applies to .DS_Store and not to .AppleDouble. – Asher – 2012-12-26T18:22:05.623

3

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

Howard

Posted 2011-07-04T13:14:38.143

Reputation: 51

The question is about files called .AppleDouble, not files starting ._ – OrangeDog – 2018-09-28T09:51:33.023

2This is not a general solution. – Adam Lindberg – 2012-07-13T14:26:46.907

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 – 2012-12-26T18:23:56.873

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.

Lri

Posted 2011-07-04T13:14:38.143

Reputation: 34 501

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.

unJordi

Posted 2011-07-04T13:14:38.143

Reputation: 11

-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.

Asher

Posted 2011-07-04T13:14:38.143

Reputation: 123

2My 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 – 2015-01-22T04:12:46.170

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 – 2016-09-27T20:02:24.857

2My 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 – 2013-01-20T04:58:14.073

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 – 2013-09-25T14:50:05.220