Delete DOS Directories Recursively
Windows XP doesn’t include my old standby “deltree,” and there is no combination of options that “del” can take to delete hidden directories recursively (yeah, I’m talkin bout you, .svn directories!)
After some rooting around the web and two tablespoons of experimentation, I’ve finally come up with the following Windows Powershell command that can recurisvely delete hidden directories and their contents:
get-childitem . -include .svn -force -recurse | foreach ($_) {remove-item -force $_.fullname}
The first “.” after the get-childitem is the base directory you want to start in. The parameter after “-include” is the pattern you want to operate on. In my case, the wretched Subversion directories (.svn)
Unfortunately, this script still prompts me for each directory I want to delete, but that’s only a tweak or two away from perfection.

Thanks, this came in quite handy deleting a bunch of .svn directories. To make it not prompt you for each one, simply add the -recurse command right after remove-item. Here is the modified command:
get-childitem . -include .svn -force -recurse | foreach ($_) {remove-item -recurse -force $_.fullname}
Thanks Tony!
Follow up note: For the case of .svn directories, I later learned about the Subversion “Export” command, which can create a SVN file hierarchy without it being versioned in the first place.
Hey Bill
Actually you don’t need to use foreach-object, you can pipe directly do remove-item. You can also replace -include with -filter, it performs faster.
get-childitem . -filter .svn -force -recurse | remove-item -recurse -force