Dec 212012
 

Mac OS X extensively uses file metadata. As this post explains there are two fallback mechanisms if a volume is not able to handle this data.

On the one hand .DS_Store files are created to store mostly Finder specific settings. On the other hand metadata like resource forks or creator types are stored in “Dot Underscore” Files. For example the metadata for the file “Demo.avb” is stored in “._Demo.avb”. Both mechanisms are great in an all Mac environment but can cause troubles in mixed setups. Luckily there are ways to at least minimize the pain.

.DS_Store

Even Apple thought that this files are not always necessary and build in a setting to disable the creation on network drives.

defaults write com.apple.desktopservices DSDontWriteNetworkStores true

Furthermore the guys from BinaryAge (the creators of the epic TotalFinder) build a tool called Asepsis. It is used to redirect all .DS_Store files into a folder buried in the depth of the system. Thereby the Finder is still able to store folder specific settings but external drives aren’t effected anymore.

Dot Underscore Files…

… cause more trouble. As they eventually store application specific data there is no official way to disable them. A possible workaround is to schedule a script to delete them (every night). This is exactly what I did for Windows (Powershell script) and Unix (Bash script) operating systems. On Windows the script can be scheduled using the “Scheduled Tasks” system setting. On Mac OS X a launchd configuration should be used – it can easily be created using Lingon. Other Unix operating systems can use a cronjob!

The script recursively searches a given folder for Dot Underscore Files and deletes them. Be aware they will most likely be recreated! You can download the Windows and Unix version using this link.

  One Response to “Win & Mac: Clean Dot Underscore Files”

  1. Hi Florian,

    I had similair problems, specifically with the ._ files that store metadata and resource-forks, so i conducted some research into this topic. (.DS_Store-files are Finder-specific, and, as you point-out , can be disabled).

    I think it’s useful to point-out that ._ files are created only on filesystems that do not support Extended Attributes, as is (was?) the case by default on SMB and CIFS shares, amongst others (e.g. MediaGrid). Mac OSX normally stores metadata in these Extended Attributes, but falls-back to ._ files when this fails.

    However, most (if not all) modern Windows servers exporting SMB-shares, support NTFS Alternate Datastreams, which Mac OSX can use to store its’ metadata (Extended Attyributes). Normally, this should be enabled by default, but this is not always the case. Fortunately it is relatively easy to force Mac OSX to use alternate stream, as is explained in this article on the Apple website.

    Basically, all you need to do is touch .com.apple.smb.streams.on in the root of the share, to create an empty file there named .com.apple.smb.streams.on.

    When you now re-connect to the share, alternate data streams should be enabled, preventing the creation of ._ files.

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)