Page 1 of 1

dos command

Posted: 18 Aug 2011 9:21
by amoniha
How can I delete directories inside a parent directory from DOS command line? I want to delete all the directories under a parent directory without deleting the parent through DOS command line. That case i don't know how many directories exist under parent.
__________________________
affiliateelite ~ affiliateelite.com ~ adgooroo ~ adgooroo.com

remove directory tree

Posted: 25 Aug 2011 6:40
by meuser
Hi,

you might try sdelete from sysinternals.
http://technet.microsoft.com/en-us/sysi ... s/bb897443 or just google 'sysinternals sdelete'
Hope this helps.

Martin

Posted: 25 Aug 2011 11:53
by philmalmaison
Hi,
Use the following:
Delete every .bak file in every subfolder starting at C:\temp

C:\>FOR /R C:\temp\ %%G IN (*.bak) DO del %%G

Regards,
Philmalmaison

Posted: 23 Sep 2012 8:03
by Allison
In one line -
Command RD (RMDIR) /s allows you to remove directory and subdirs and files in it, BUT it removes the dir itself too...
If you want to remove EVERYTHING in dir (incl. subdirs AND files) then the two commands option is:
RD /s/q myDir
MD myDir

If this is NOT suitable, then you will have to loop through directory content and RD /s each of the subdirs...