Reputation: 826
My DESKTOP contain copies of 'CEEMEA EMEA' folder i.e.
EMEA CEEMEA
EMEA CEEMEA - Copy
EMEA CEEMEA - Copy (2)
EMEA CEEMEA - Copy (3)
and so on
I want to delete all folders that starts with EMEA CEEMEA as file name using CMD
or batch-file.
rd /s /q "%CD%\NEW FOLDER*"
but above command not doing anything. how does it work?
Upvotes: 0
Views: 917
Reputation: 38579
You can do this using a For
loop with its /D
option:
For /D %A In ("%UserProfile%\Desktop\EMEA CEEMEA*")Do @RD/S/Q "%A"
As you've updated your question to include batch-file, you'd change the command to this from one:
For /D %%A In ("%UserProfile%\Desktop\EMEA CEEMEA*")Do @RD/S/Q "%%A"
Upvotes: 1