On 7 Jan 2009, at 14:52, Eric F Crist wrote: > ... > Couldn't this same thing be accomplished with a shell script calling > the find command? In that instance, ruby/etc isn't required. > > As an example (this could be cleaned up with a proper regex, I think): > > find . -name ".DS_Store" \ > -or -name ".Spotlight-V100" \ > -or -name ".fseventsd" \ > -or -name ".Trashes" \ > -or -name "__MACOSX" \ > -maxdepth 1 \ > -delete > > Again, just an example. I had a crack at this a while back, and ended up when I realised how poor my solution was. IMO you really need to use `file` to check that the files really ARE Mac rubbish. EG: FILE=/usr/bin/file BASENAME=/bin/basename if [[ `$FILE -b "$1"` = "data" ]] && [[ $BASSNAME = ".DS_Store" ]] then echo Removing "$1" >&2 # deal with .DS_Store files once & for all rm -f "$1" else if [[ `$FILE -b "$1"` = "empty" && ${BASSNAME:0:4} = "Icon" ]] then echo "Removing $1" >&2 # deal with funny Icon files rm -f "$1" else if [[ `$FILE -b "$1"` = "AppleDouble encoded Macintosh file" ]] then # file is prolly a resource-fork if [[ $BASSNAME = "._.DS_Store" ]] then echo "Removing $1" >&2 rm -f "$1" else if [[ ${BASSNAME:0:6} = "._Icon" ]] then echo "Removing $1" >&2 rm -f "$1" ... At the time I was unaware that bash sported functions, so worked around this by having the script call itself recursively and behave differently depending whether it was called with a directory or file for an argument. I gave up when I realised how horrible this was, the script having spawned a zillion children of itself <shame>. Although I would love someone else to address this problem, I too would be a little reluctant to use a solution that depended upon Ruby, just because I don't know anything about the language. I just really like Bash for this sort of thing, just because it's everywhere. Stroller.