Was cleaning up a harddrive I moved to a linux box and wanted to get rid of all the ‘.’ files that OSX leaves around. An easy way to list the hidden files, or so it would seem, would be:

find ./ -name “.*"

And it would look correct. But unfortunately this also catches the filesystem pointer of “./” so if you pass it to, say rm -rf then you may recursively delete everything in that directory. In order to prevent this you need to specify “-type f” so that it doesn’t catch the pointer. So:

find ./ -type f -name “.*” -exec rm -f {} ;

Should work a bit better. Of course, always have a backup.