Delete Folders using Command Line(Recursively)

I had a requirement to delete all .svn directories in my folder in windows. This is how i did it

for /r %R in (.svn) do if exist %R (rd /s /q "%R")

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

del /s/q *.svn


for /d /r . %d in (.svn) do @if exist "%d" rd /s/q "%d"


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

In *nix Systems

to find : find . -type d -name .svn
to Delete : rm -rf `find . -type d -name .svn`


6 thoughts on “Delete Folders using Command Line(Recursively)

    • Check Folder Permissions. Generally all Project folders in SVN are Readonly. If you remove ReadOnly it should work.

      I’m not sure which command works among the three in your machine (Those are commands i have tested in multiple windows machines) , but one of the command will work for sure

  1. After removing the readonly permissions also, only the files within the .svn is removed and not the folder. Also would it be possible to include remove irrespective of permissions ? Like the way it gets removed when I search *.svn using windows search and delete it ?

    the second command doesn’t work. The third command gives no error or result.

  2. Lourdes Amil is a Marketing specializer for of the Jeep &
    offers auspices to the number one wood & the nominal head president passenger.
    Whether it’s your own slight one, your niece, nephew, cousin-german, brother, baby all varieties, including rock Maven and sports lover. I set up this mails, photos and as well shop and listen to euphony.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s