Command line tool to delete folder with a specified name recursively in Windows?

opensas picture opensas · Feb 6, 2009 · Viewed 59.4k times · Source

I want to delete every "_svn" in every folder and subfolder...

For example

c:\
  proyect1
   _svn
   images
     _svn
     banner
       _svn
     buttons
       _svn

Then I run something like

rm-recurse c:\proyect1 _svn

And I should get:

c:\
  proyect1
   images
     banner
     buttons

The ideal thing would be a tiny stand-alone EXE or something like that.

-- Thanks Grant, as soon as I posted the question I saw SVN documentation about the SVN export command, but I also want to delete the _vti_* folders stuff Visual Studio creates, so I'll also explore the for solution.

Answer

JMD picture JMD · Feb 6, 2009

Similar to BlackTigerX's "for", I was going to suggest

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