Removing all CVS directories

How to Remove all CVS directories in a source tree

Sometimes one wants to delete all the CVS directories from a source tree. There are a number of scenarios under which one may want to perform this, including:

  • To prepare a source tree for check-in to another repository (e.g. a Subversion repository or a different CVS repository)
  • To copy code to a clean local workspace
  • To extract a new module from an existing project

Rather than clicking about, using an Explorer interface, or struggling with the idiotic scripting language that is supported by the Windows command interpreter, the simple and elegant solution is to use a bash command from within a Cygwin shell (which you certainly must have already installed).

Just issue the following command in the root directory from which you wish to delete all CVS subdirectories:

rm -rf `find . -name CVS`

This command would likely fail for a large project, as the list of CVS directories would exceed the maximum shell input buffer size. Try this instead:

find . -name CVS -exec rm -rf {} ;

If the project is open in Eclipse, you might simply prefer to use Team -> Disconnect… and select the option to remove the CVS metadata.

It's only fair to share...
Share on Facebook
Tweet about this on Twitter
Share on LinkedIn

Leave a Reply