HOWTO: Removing ALL folders named ‘CVS’ in Unix and Windows

Posted : April 29, 2004 at 9:04 am [America/Los_Angeles]

You have a working directory of a CVS module. You want to de-CVSify it so that you can a) use folders in another CVS project you’re about to import or b)package it up for someone without all the CVS clutter. How would you do it natively in WinXP and Unix . No Cygwin hacks in Windows or some Windows util on Unix allowed (if something like that even exists..).

In Unix, thanks to ‘find’ and ‘xargs’ this thing is fairly simple in Unix:

Assuming name of the folder is ‘cvsapp’, the command would look something like:

(unix prompt)>find /foldername | xargs rm -r

In Windows, it’s not too bad either:


Go to the folder in Windows explorer, click on ‘Search’. A window such as the one shown above would open up. Enter CVS and hit ‘Search’. Then select all and ‘delete’ it.

Needless to say, each of the approaches can be tweaked for your specific needs (which might have nothing to do with CVS folders). Here’s an exercise for you (and me) and maybe I will talk about it my next HOWTO assignment:

What if you wanted to search for all files or folders starting (or ending) with ‘evil’ and wanted to trash those?

- Anand

Viewed: 1619 times

6 Comments »

I’d use ‘cvs export’ ;) Not too shabby for me. Why mess around with stuff, when there’s already a solution built in.

Regards, Mathias

Posted by: Mathias Meyer at April 29, 2004 @ 10:38 am

rm `find /foldername -name “CVS”`
works as well

Posted by: Don Brown at April 29, 2004 @ 11:05 am

Mathias: Thanks for the tip. Did not know that’s what ‘cvs export’ did. Always cared for the ‘cvs import’ command..;-)

Posted by: Anand at April 29, 2004 @ 1:34 pm

No need for xargs:
find -name CVS -exec rm -r {} \;

Posted by: Chris Nokleberg at April 29, 2004 @ 2:24 pm

True. It’s just that there are documented cases where exec has not been very portable across various unix implementations. Plus, the -exec \; syntax is kinda wierd .

Thanks for the reminder Chris. I actually had forgotten about -exec option completely.

Posted by: Anand Sharma at April 29, 2004 @ 3:20 pm

The “documented cases” is just some dude who says its unreliable. He doen’t say where or what. I used find -exec on more Unix platforms than you can name and never found a problem.

Java Dude

Posted by: Java Dude at November 10, 2005 @ 9:11 am

Leave a Comment