Saturday, 25 May 2013

How do I remove 1,000,000 directories? -- not [duplicate]

How do I remove 1,000,000 directories? -- not [duplicate]

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. Deleting the commplete directory is as slow as before.
rmdir /Q /S WebsiteCache
mkdir WebsiteCache
I noticed after two hours that the directories starting with A-H have been removed.
Why does rmdir removes the directories in alphabetical order? It must take additional effort to do this ordered.
What is the fastest way to delete such an amount of directories?

No comments:

Post a Comment