31 December, 2009

Simple delete of subdirectories only

Hi,

Just found a solution to delete subdirectories from the root of a disk.
Normally to delete a subdirectory you use the RD command but you cannot delete the root folder so you have a problem.

Not anymore...

================================
dir f: /B > dir.txt
for /f %%f in (dir.txt) do (rd f:\%%f /S /Q)
del dir.txt /q
================================

Enjoy.

No comments:

Post a Comment