Daten|teiler
Kopieren als Kulturtechnik

[Update] What is :2eds_store?

9. Januar 2007 von Christian Imhorst

The file :2eds_store is usually created by Apple’s Mac OS X to store the listing view of a Finder window. When you connect your Mac to a Linux box with AppleTalk and you browse your directories with the Finder application it will create this file and some more like .AppleDouble or directories like Network Trash Folder in every directory you have visited. With this script you can clean up your Linux file system from these needless files:

[Update] Here comes the real new script sauber. It is based on the older script clean:

#!/bin/bash
# Script:          sauber
# Object:         Cleans up your Linux file system after a 
#                    session with AppleTalk and Finder.
# Etymologie:   sauber means clean in German
 
# Test number of arguments here
if (( $# < 1 )) ; then
	echo
        echo "We need an argument here."
	echo "Usage:   ./sauber [Directory]"
	echo "Example: ./sauber /home/christian" 
	echo >&2
        exit 1
fi
 
find $1 &#092;( -iname &#039;:2eDS_Store&#039; &#092;
-o -iname &#039;.AppleDouble&#039; &#092;
-o -iname &#039;Network Trash Folder&#039; &#092;
-o -iname &#039;Temporary Items&#039; &#092;
-o -iname &#039;:2elocalized&#039; &#092;
-o -iname &#039;.DS_Store&#039; &#092;
-o -iname &#039;._*&#039; &#092;) -exec rm -rf {} &#092;&#059;
 
exit 0

For comparison I leave the old script here:

#!/bin/sh
# Script:	   clean
# Object:      Cleans up your Linux file system after a session with 
#                 AppleTalk and Finder.
 
find $HOME -name :2eDS_Store -or  &#092;
-name .AppleDouble -or &#092;
-name &#039;Network Trash Folder&#039; -or &#092;
-name &#039;Temporary Items&#039; -exec rm -rf {} &#092;;

These two examples show that I have learned pretty much about writing shell scripts in the last year. Note that the first posting of this script was in February 2006. ;-)

[Update] If you want to prevent Mac OS X to generate .DS_Store Files open Terminal.app and type

defaults write com.apple.desktopservices DSDontWriteNetworkStores true

and log off. Log on again and Mac OS X won’t create .DS_Store Files again. But this must be made for each user.

If you want the .DS_Store Files back remove with

rm -i $HOME/Library/Preferences/com.apple.desktopservices.plist

Geschrieben in English, MacOS X und iPhone

5 Antworten

  1. artm

    hi Christian

    being a performance junky I’d rather say

    find $HOME -name :2eDS_Store -or\
    -name .AppleDouble -or\
    -name ‘Network Trash Folder’ -or\
    -name ‘Temporary Items’ -exec rm -rf \{}

    this way find only traverses your home directory tree once.

    cheers

  2. christian

    Yes, you are right. It is better to do this in the script with an environment variable like $HOME instead of my real username. Thanks.

  3. Simon

    Thanks very much

  4. barner.dk

    What does those DS_Store files actually do ? why are they there and why are they made by osx?

    kindly from Barner.dk

  5. Christian Imhorst

    Hi Mark,

    you can find an answer at Wikipedia:

    http://en.wikipedia.org/wiki/.DS_Store

    Hope that this article will help you.

    Regards,
    Christian