1.

Solve : Deleting multiple unknown subdirectories ??

Answer»

Hi,

I'm looking for something to delete multiple subdirectories (along with files in them) of which the names i will for the sake of this pretend to not know.

E.G. i WANT to delete directories "A, B & C" in the directory "Alpha", so not the whole directory "Alpha"

Thanks for any replies in advance.cd\alpha
rmdir /q/s a & rmdir /q/s b & rmdir /q/s cAnd i quote:
"I'm looking for something to delete multiple subdirectories (along with files in them) of which the names i will for the sake of this pretend to not know."

So, that means.. that i do not know those directories are called A, B & CSo how do you know that you want to delete them ??

Is it all subdirectories under Alpha ?I know because it are multiple Cache directories made by a game with never the same name.

and as for that i can only say: Yes.Thats easy then, USE a for loop to identify all directories and delete them

:: ensure we are in the correct dir
Cd \alpha

For /D %a in (*.*) Do RmDir "%a"


NOTE : if you run it from a batch file, the loop command needs to look like this (note the doubled % symbols):
For /D %%a in (*.*) Do RmDir "%%a"

GrahamNice, thank you.

Though 1 small problem.
how do i implement /Q in this in a way it actually works ?
because im sure you know it will otherwise say: Directory not emptyTry this

For /D %a in (*.*) Do RmDir /S/Q "%a"
GrahamQuote from: NiTeCr4Lr on November 20, 2007, 05:57:32 AM

And i quote:
"I'm looking for something to delete multiple subdirectories (along with files in them) of which the names i will for the sake of this pretend to not know."

So, that means.. that i do not know those directories are called A, B & C

my badNp Diablo461

Quote from: GPL on November 20, 2007, 09:45:11 AM
Try this

For /D %a in (*.*) Do RmDir /S/Q "%a"
Graham

Thanks again gpl : )


Discussion

No Comment Found