2

Is there a way to do this? I have a folder structure as such:

A/
    Folder/
B/
    Folder/
C/
    Folder/
D/
    Folder/

And I want to delete all of the "Folder/"s, along with all of their contents. My first guess was

rmdir /S /Q *\Folder

but received an error on the *. This has come up a few times in the past days, so I figured I'd get the more efficient way than going into each folder, because that wasn't fun.

Ledivin
  • 637
  • 5
  • 18

2 Answers2

0

Have you try this ?

for /D %i in ("C:\Directory\*") do RD /S /Q "%i"

Put double % if you want to do this in batch file

TheMightyX2Y
  • 1,473
  • 1
  • 16
  • 24
0

This should display the rd command for every directory that matches the folde? filespec under the current tree.

The wildcard is necessary so check the output before removing the echo

@echo off
for /d /r %%a in (folde?) do echo rd /s /q "%%a"
pause
foxidrive
  • 40,353
  • 10
  • 53
  • 68