Note that I'm not trying to disable the creation of these files. I want to keep them around until I'm ready to commit changes to my source control.

The files are scattered throughout many subdirectories of the main source code directory and are of the format "._". For example, test.txt becomes ._test.txt.

I've tried this command, but it doesn't work:

rm -rf ._*

Any thoughts?


3 Answers 3


GNU find has a -delete option. If you have GNU find, this should work (and it should be immune to any problems with whitespace and other funny characters in file names):

find . -name '._*' -delete

From the documentation (info find):

-- Action: -delete
    Delete files or directories; true if removal succeeded.  If the
    removal failed, an error message is issued.

    The use of the `-delete' action on the command line automatically
    turns on the `-depth' option (*note find Expressions::).  This can
    be surprising if you were previously just testing with `-print',
    so it is usually best to remember to use `-depth' explicitly.

    If `-delete' fails, `find''s exit status will be nonzero (when it
    eventually exits).
  • OS X doesn't ship with GNU find though.
    – slhck
    Oct 11, 2011 at 22:08

Decided to use this instead:

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

However, I'd love to hear if there's a better way to do this.

  • Using find and xargs is a bit tricky. Read the find manual that says: "However, you may wish to consider the -print0 primary in conjunction with xargs -0".
    – slhck
    Oct 11, 2011 at 21:40
  • Using {} in this way will cause serious errors with files having names with embedded whitespace. Almost always correct to us '{}' instead. Sep 29, 2015 at 16:43

While deleting them isn't particularly harmful, it'd be good to be sure you know what you're discarding since those are in fact neither temporary files nor unique to TextMate.

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.