Ask Different is a question and answer site for power users of Apple hardware and software. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I totally hate to see those .dsstore and resource files on my Windows disks.

Is there a free program that will autodelete those files on specified disks on logout/eject?

share|improve this question
.dsstore and resource files aren't in the same category. For some files, deleting the resource fork will result in substantial data loss. – Daniel Sep 27 '11 at 20:18
for me are in the same category: litter. Of course I won't move system files on a windows disk (why I should), so I think it's 100% safe to delete them. – Magnetic_dud Sep 27 '11 at 23:24
up vote 3 down vote accepted

There are many ways to remove .DS_Store files; it really depends on what your exact needs are for the method you decide to use. To automatically remove them when you login/logout would be quite different from ejecting a disk, since it's a completely different process. You can disallow .DS_store for from being allowed to write to network disks, etc. by opening up Terminal and entering:

defaults write DSDontWriteNetworkStores true

to manually remove already present .DS_Store files you can use:

dot_clean /path/folder

which merges any such files with the parent file.

share|improve this answer
it's possible to run this command at the logout? – Magnetic_dud Sep 27 '11 at 23:26
It's possible to run commands (in the form of a shell script) at logout using what Apple calls a LogoutHook, but the exact method varies depending on the exact version of OS X you're running. Here is the general method I've used in the past. The Secrets pref pane from Blacktree also has an option for specifying a LogoutHook script. – scottishwildcat Sep 27 '11 at 23:57
@scottishwildcat — awesome explanation and tips! ;-) – l'L'l Sep 28 '11 at 0:09

Resource forks don't exist as actual forks anymore. They have been stored as extended attributes since 10.4.

The files that start with ._ are used to store extended attributes, ACLs, and HFS file attributes / Finder flags. They can be deleted with dot_clean or find:

dot_clean /Volumes/Volume
find /Volumes/Volume -name ._\* -delete

.DS_Store files can be deleted with find:

find /Volumes/Volume -name .DS_Store -delete

Another option is to use BlueHarvest:

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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