0

I am aware that RMDIR /S /Q will delete any directory in a quiet way even if it has content.
However, it does not allow the use of wild char for the removal in batch mode.
How can I accomplish the task of deleting several directories at once at the command line?
e.g.

C:\ByeBye>
SL2007Ext1
SL2007Ext2
SL2007Ext3
...
2
Contributors
2
Replies
3
Views
9 Years
Discussion Span
Last Post by Aia
0

Hmm not sure if it's easy for windows. Linux would be another matter as I'm sure you already know.

The best I could come up with was using...

dir SL2007Ext*

to list all the directories.

I tried using

rd SL2007Ext*

but that didn't work.

0

Since I don't know Windows scripting in vbs, and having a version of the GNU Minimalistic (MSYS) installed, it occurred to me to use what I know. rm -r SL2007Ext? That did the trick.

However, further experimenting proved fruitful with FOR FOR /D %G IN ( SL2007Ext? ) DO RMDIR /S /Q %G Credits go to Dave Sinkula that initially pointed me to it, and encouraged me to post the solution for future searches.
If you want to include it in a batch script an extra % needs to be included in the variable.
e.g. FOR /D %%G IN ( SL2007Ext? ) DO RMDIR /S /Q %%G

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.