Find and remove .DS_Store and .AppleDouble

How to find, remove and prevent the creating of the .DS_Store files and .AppleDouble directories on a networked drives.

.DS_Store (short for Desktop Services Store) - is a hidden file with a proprietary format created by OS X to store custom attributes of a folder such as the position of icons or the choice of a background image. By default, Finder creates a .DS_Store file in every folder that it accesses, even folders on remote systems (for example, folders shared over an SMB or AFP connection). The Microsoft equivalent for this file is desktop.ini.

.AppleDouble directories contain metadata relating to files. That allows the system to work with formats of disk (such as remote NFS, SMB, WebDAV directories, or local UFS volume) which does not support resource forks natively. The small binary files within the .AppleDouble directories have the same name as the actual files, and contain metadata about the file which cannot be stored inside the file itself, such as indexing information. Windows have similar metadata files called Thumbs.db.

.DS_Store and .AppleDouble are invisible to the average user, but if you are sharing with a Windows / UNIX PC or have hidden files shown in Finder then you will see them in every directory.

Deleting all .DS_Store and .AppleDouble

The method described below will find and delete all .DS_Store files and .AppleDouble directories. This can help to avoid clutter on a networked drives.

1. Open Terminal.

2. Go to the needed directory, example:

cd your_folder

3. Execute this command:

find ./ -depth-name".DS_Store"-exec rm {}\;

4. And then execute this command:

find ./ -depth-name".AppleDouble"-exec rm -Rf{}\;

These commands search in every subdirectory, starting from the current directory.

3. Either restart the computer or log out and back in to the user account.

If you want to prevent .DS_Store file creation for other users, then you need to perform the steps above on each user account on each Mac.

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

Note: These steps do not prevent the Finder from creating .DS_Store files on the local volume and do not prevent previously existing .DS_Store files from being copied to the remote file server.

To stop the creation of .AppleDouble directories you need to edit your AFP service configuration (on a networked drive). There is usually a “No AppleDouble” or “Enable AppleDouble” configuration setting that needs to be set true (for the NO option) or set to false (for the Enable option).

About

My Cyber Universe was founded in May 2013 by Arthur Gareginyan, a designer and full stack software engineer. Main goal is to be the source for anyone who wants to learn the web design, software and web development.