Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

When I revert in Mercurial, it leaves several .orig files. I would like to be able to run a command to remove all of them.

I have found some sources that say to run:

rm **/*.orig

But that gives me the message:

rm: cannot remove `*/.orig': No such file or directory

I have also tried:

  • rm -rv *.orig

  • rm -R *\.orig

share|improve this question

1 Answer 1

up vote 23 down vote accepted

Use the find command (with care!)

find . -name '*.orig' #-delete

I've commented out the delete command but once you're happy with what it's matching, just remove the # from the line and it should delete all those files.

share|improve this answer
    
Does that work recursively? –  Frank Barcenas May 25 '13 at 22:15
    
@FrankBarcenas Yeah - find does everything recursively. If you want to limit how that works, you can play with the -maxdepth or -mindepth arguments. –  Oli May 26 '13 at 9:37

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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