“Recursively delete .svn directories” 1

Posted by Piyush Gupta on October 18, 2009

Many of us sometime or the other need to delete all .svn folders from our app . So why make it difficult to actually tree down each folder and manually delete when you can use command line to do it .

We use find command to find all .svn folders beginning from current directory.

$ find . -type d -name .svn
./.svn
./sourceA/.svn
./sourceB/.svn
./sourceB/module/.svn
./sourceC/.svn

It is possible to pass these directories directly to rm command, using grave accent quotes (key to left of ‘1′)

$ rm -rf `find . -type d -name .svn`

So, this will remove every .svn folder beginning from current directory.

Technorati Tags: , ,