Thursday, May 13, 2010

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.How can I delete directories inside a parent directory from DOS command line?
In one line - I do not think that you can...


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...
  • jabbawockeez mask
  • No comments:

    Post a Comment