How do I remove 1,000,000 directories?

Posted by harper on Super User See other posts from Super User or by harper
Published on 2011-01-04T15:35:09Z Indexed on 2011/01/04 17:56 UTC
Read the original article Hit count: 191

Filed under:
|
|
|

I found that in a directory more than 1,000,000 subdirectories has been created due to a bug.

I want to remove all these directories, let's say in the directory WebsiteCache. My first approach was to use the command line tool:

cd WebsiteCache
rmdir /Q /S .

This will remove all subdirectories except the directory WebsiteCache itself, since it is the current working directory.

I noticed after two hours that the directoriws starting with A-H have been removed.

  1. Why does rmdir removes the directories in alphabetical order? It must take additional effort to do this ordered.

  2. What is the fastest way to delete such an amount of directories?

© Super User or respective owner

Related posts about windows-xp

Related posts about Performance