I want to delete all files that start with ._, when I run this command:

me@me:/var/www/my/project$ sudo rm -Rvi ._*
rm: cannot remove `._*': No such file or directory

I'm pretty sure the . is causing problems, making it think I mean the current directory, what's the correct syntax to achieve this?

I know these files originated from my Mac, I need a way of nuking them :-)

Many thanks


  • Hmm, I cannot seem to be able to reproduce your problem. (touch ._test, rm ._* works fine.) Maybe there's some other attributes that make the difference? Files beginning with a period aren't anything special, as it is the convention to 'hide' e.g. configuration files (~/.profile). – Jawa May 26 '10 at 9:58

You can try this:

find -name ._\* |xargs sudo rm -Rvi

or if your shell doesn't like that:

find |grep -e '^\._' | xargs sudo rm -Rvi

find without any arguments should just list everything.

| improve this answer | |
  • Thanks! The first options worked fine when I did this: find -name ._\* |xargs sudo rm -v <-- left it with just verbose :-) – Ben Everard May 26 '10 at 10:41
  • 1
    This won't work if filenames contains spaces or newlines. To support those, use find -print0 and xargs -0. According to a colleague, removing all ._* files messes up SVN directories. He uses find . -type f -name "._*" -perm +w -delete, because ._* files in SVN are not writable. – Sjoerd May 26 '10 at 12:02
  • @Sjoerd, that is indeed more elegant. – Nathan Fellman May 26 '10 at 12:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.