Tuesday, December 15, 2009

How To Recursively Delete .svn Folders

Today, using versioning system on a software development is a must. This is to avoid the replacement of a file that can occur while the development process.

When using versioning system such as Subversion, the system will automatically create a .svn folder on each folder we have. The bad things come whenever we have to send a project folder to other people. It's not convenient if we send them a project folder with .svn folder in it. Yes, we need to clean the .svn folder.

On a Linux environment, go to your project folder and type the syntax below :

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

On a Windows environment, please create one batch file for example cleansvn.bat and put the code below to that batch file :

FOR /F "tokens=*" %%G IN ('DIR /B /AD /S *.svn*') DO RMDIR /S /Q "%%G"

Execute your batch file on a Windows command line and give your project folder as a parameter (in this example: d:\master\htdocs\vivanews.com is a project folder which we want to clean from .svn)

D:\>cleansvn.bat d:\master\htdocs\vivanews.com

And voila ... your project folder is clean from .svn files. Hope this help.

No comments: