Deleting subfolders /batch

June 11, 2009 at 22:37:15
Specs: Windows XP
Im trying to delete the contents of the e:\test folder using the command:

echo y | del e:\test\ /s

via a batch file, though it doesnt delete the subfolders, only the files. Anyone know how to amend the syntax to do this or if theres another way to do this?


See More: Deleting subfolders /batch

Report •


#1
June 12, 2009 at 07:18:34

The following statement deletes all subfolders in E:\test

for /D %%j in (E:\test) do RD /S /Q "%%j"


Report •

#2
June 14, 2009 at 20:21:08
Ive tried the command ;

for /D %%j in (E:\test) do RD /S /Q "%%j"

from the prompt in dos though receive the error;

"%%j was unexpected at this time." Is %%J a referance or am I missing something.



Report •

#3
June 15, 2009 at 00:33:16
If you use for loops from the command line only one percent % sign is used for for loop variables, inside batch scripts two %% are used. Use %j instead of %%j.

Report •

Related Solutions


Ask Question