Delete .svn directories recursively

I am here showing an example of a unix command, which recursively deletes subversion .svn folders. Subversion is a widely used open-source revision control application. Every copy of source code received from subversion repository has .svn folders, which store metadata. However, if you want to use or distribute source code, these .svn folder are often not necessary.

To remove this we can follow the following steps:

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

Now pass this to RM command using grave accent quotes (key (`) to left of ‘1’)

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

If you need to remove the .svn very frequently then simply save this command inside a script and execute that whenever is required.

Hope this helps 🙂