Any Macintosh user who shares files with Windows/Linux users whether on a network or thumb drive has experienced the horror of the “Mac droppings” they have left behind. I am referring to the .DS_Store, .Trashes and “._*” files that get strewn around the file system of the unsuspecting host. Usually, the user comes back, scrapes some of it off their shoe and asks what they are for. You end up apologizing and letting them know that you have no idea how they got there but they can probably just delete them. Essentially, you are saying “Please clean up after me”.
Was it something I ate?
No, these are normal parts of the Mac OS that are hidden to the Macintosh user but are not hidden to a Windows/Linux user who views the filesystem that you have been writing files to. To be fair, these are not really useless file to the Macintosh. .DS_Store files contain settings which are “cosmetic” in nature — for example, Finder window position, view style, icon position, etc. However, .DS_Store files in OS X also store Finder “comments” so in this sense, disabling .DS_Store files may result in loss of data. “._*” files contain extra information to go along with the main file’s data but don’t play well on non-HFS+ file systems. The .Trashes folder that get created is just that. The trash. It is where the Macintosh puts items on the volume that are trashed.
How embarrassing, what can I do?
Good news, there are steps you can take to reduce or even eliminate those embarrassing droppings. Some of these methods may require you to carry a bag with you when you are visiting other file systems but at this point Apple has not given any other alternatives.
1. Disable the creation of .DS_Store files on external volumes.
There is a way to tell your Macintosh that you don’t want it creating .DS_Store files on external volumes that you are visiting.
Copy/Paste “defaults write com.apple.desktopservices DSDontWriteNetworkStores true”
You may need to logout or restart your computer after executing this command
2. dot_clean is your friend
Prior to Mac OS 10.5 you had to manually delete the ._resource files. With 10.5 though Apple introduced the dot_clean command that can be executed on the direcory in question. Type dot_clean /path/folder to join the “._*” files with their parent files. It is recursive so it should take care of all of the child folders also. This should be done prior to ejecting the volume. Read OS X 10.5’s manual pages (man dot_clean) for more information. Although many on the web will claim that dot_clean will remove .DSStore files, it does not. It only merges and removes “._*” files.
3. Recursively remove .DS_Store files from a friends thumbdrive
find . -name ‘*.DS_Store’ -type f -delete
4. Remove .Trashes folder from a friends thumbdrive
find . -name ‘*.Trashes’ -type d -delete
All of this could be wrapped up in a single script (which I may post later) that you could execute before ejecting volumes. It would be great to be able to configure your OS to execute the script automatically prior to ejecting a volume but that is not an option at this point.
Keep it clean,