Recursively delete all folders starting with

后端 未结 5 660
礼貌的吻别
礼貌的吻别 2021-02-05 20:24

I need to write a command in a .bat file that recursively deletes all the folders starting with a certain string. How may I achieve this ?

5条回答
  •  不思量自难忘°
    2021-02-05 21:07

    How about:

    for /d %a in (certain_string*) do rd /s %a
    

    This will work from the command prompt. Inside a batch file, you would have to double the %s, as usual:

    @echo off
    for /d %%a in (certain_string*) do rd /s %%a
    

提交回复
热议问题