BBMAN225
BBMAN225

Reputation: 673

Deleting folders in batch?

I tried to delete a folder, so I tried 'DEL "%Folder%"'. That left the folder itself behind, and deleted all files within the folder. Then I typed DEL /? into the cmd prompt and read "If a directory is specified, all files within the directory will be deleted." So, what do I have to do to delete the folder itself?

Upvotes: 0

Views: 129

Answers (2)

Olimpiu POP
Olimpiu POP

Reputation: 5067

I suggest using RD or RMDIR commands. A more detailed usage description here.

Syntax:

RMDIR [/S] [/Q] [drive:]path

RD [/S] [/Q] [drive:]path

Upvotes: 2

Joel Daignault
Joel Daignault

Reputation: 111

You can try using RMDIR "%Folder%" to remove the directory (and sub directories with /s if desired).

http://technet.microsoft.com/en-us/library/bb490990.aspx

Upvotes: 2

Related Questions