Macos – Remove all Mac generated files ‘._’ with bash

macosssh

I'm trying to find the command to delete recursively all Apple Mac generated files such as '._' from the drive. So far I have:

find . -name '._*' -exec rm -rf {} \;

however it doesn't seem to do the trick.

Best Answer

There's now a better way!

See man dot_clean since OS X 10.5.

dot_clean -n . will not just delete the dot underbar files in and below the current directory, it'll merge their information into the parent file if it's not already there (and I infer that you want -n to also delete the dot underbar file if there is no matching native file).

Related Question