Recursively delete .svn directories

Friday, October 17, 2014

How to Recursively delete .svn directories and files on linux, centos, ubunto :-

Step 1. "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


Step 2. rm command remove all .svn directories
     
     $ rm -rf `find . -type d -name .svn`


More Commands :-

find . -name .svn -exec rm -rf {} \;
Before running a command like that, I often like to run this first:

find . -name .svn -exec ls {} \;

or

You almost had it. If you want to pass the output of a command as parameters to another one, you'll need to use xargs. Adding -print0 makes sure the script can handle paths with whitespace:

find . -type d -name .svn -print0|xargs -0 rm -rf

0 comments:

About This Blog

Lorem Ipsum

  © Copyright 2009 Linux-HelpLine.Blogspot.com

Back to TOP