wildcarddosdelrmdir

Delete dos folders 4 chars long starting with letter S


I am trying to find a command, which could be described like

rmdir s???

i.e. delete all folders in current dir starting with S, exactly 4 characters long. I've tried rmdir, del, erase, none of them works. Any ideas please? Will it be different for empty and non-empty folders?


Solution

  • I've found something similar to the first answer (in case of empty folders just remove the /s switch)

    for /d %n in (s???) do rd  /s "%n"