How to remove CVS and/or .svn files and folders form the command line in Linux

So, you copied a bunch of directories from one source controlled project to another and you don’t want to go through and delete all those CVS or .svn directories by hand? Ok, no problem…

Below are two snippets that will show you how to recursively remove those directories from the Linux command line in one quick instant. Just be sure that if you click-paste these into your shell window, that you are already in the top directory off where you want to delete stuff. I’ve made the mistake of doing it in the wrong folder without thinking and it automatically deleted all my CVS files for an entire project!

For CVS:

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

For SVN:

find . -name .svn -prune -exec rm -rf {} \;

 

The original article by Marc and lampjunkie.com can be found here: http://www.lampjunkie.com/2008/05/remove-cvs-or-svn-directories-from-the-linux-command-line/

LiveZilla Live Help