Caveman's Blog

My commitment to learning.

Recursively delete a folder

Posted by cavemansblog on July 1, 2009

Today is the first day for me on another project at work. I could not get the latest code  from Subversion [2] because I did not have sufficient privileges. I had borrowed the source code from a colleague so that I can get up to speed with the existing framework, while the permissions are resolved. In the solution that I copied all the sub folders had a “.svn ” folder and I just did not like that.

I thought of writing a .Net console app to recursively delete all the “.svn” folders of the solution and as always googled first, to see if there was a easy alternative — why reinvent ;) . Indeed there is a command line solution by “Eber Irigoyen” [1], that does a fantastic job. Here is how I used the command;

1. Open a command window.
2. Navigate to the root folder from where you would want to start deleting the “.svn” sub-folder recursively.
3. Execute the following command


for /f "usebackq" %d in (`"dir *.svn /ad/b/s"`) do rd /s/q "%d"

Replace the “.svn”  from the command with another folder name to delete it recursively.

Reference:
1. Recursively delete svn folders easy way
2. Subversion

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>