dos command

Some examples running with Control-M and Control-EM database.
Post Reply
User avatar
amoniha
Nouveau
Nouveau
Posts: 2
Joined: 09 Feb 2011 12:00

dos command

Post by amoniha » 18 Aug 2011 9:21

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

User avatar
meuser
Nouveau
Nouveau
Posts: 4
Joined: 23 Nov 2010 12:00

remove directory tree

Post by meuser » 25 Aug 2011 6:40

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

User avatar
philmalmaison
Nouveau
Nouveau
Posts: 1148
Joined: 08 Jun 2007 12:00
Location: Ile de France

Post by philmalmaison » 25 Aug 2011 11:53

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

User avatar
Allison
Nouveau
Nouveau
Posts: 14
Joined: 22 Sep 2012 12:00

Post by Allison » 23 Sep 2012 8:03

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...

Post Reply