Computing.Net > Forums > Programming > Deleting subfolders /batch

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Deleting subfolders /batch

Reply to Message Icon

Name: Dosnotes
Date: June 11, 2009 at 22:37:15 Pacific
OS: Windows XP
Subcategory: Batch
Comment:

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?



Sponsored Link
Ads by Google

Response Number 1
Name: IVO
Date: June 12, 2009 at 07:18:34 Pacific
Reply:


The following statement deletes all subfolders in E:\test

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


0

Response Number 2
Name: Dosnotes
Date: June 14, 2009 at 20:21:08 Pacific
Reply:

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.



0

Response Number 3
Name: Judago
Date: June 15, 2009 at 00:33:16 Pacific
Reply:

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.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Deleting subfolders /batch

VBS to delete subfolders in folders www.computing.net/answers/programming/vbs-to-delete-subfolders-in-folders/18420.html

Batch file to delete folder in fol. www.computing.net/answers/programming/batch-file-to-delete-folder-in-fol/16994.html

vbscript to delete subfolders www.computing.net/answers/programming/vbscript-to-delete-subfolders/10850.html