Delete the folder whose name begins with something on the command line (batch)

I read and tried the code from

I want to create a package that deletes a folder whose name begins with Test_ . I have a folder D:\Test_123_19_10_2012 .

How to write in batch or command line? Need a regular expression?

Thank you for your patience.

+4
source share
1 answer

Here you go

 for /d %%a in (D:\Test_*) do rd %%a /q 

The for loop is necessary because rd does not seem to support wildcards.

+8
source

Source: https://habr.com/ru/post/1440757/


All Articles