Windows Server 2003 -- deleting millions of files in a folder?

Solution 1:

I suggest you don't even try this from the GUI because that would cause Explorer to open each and every file to determine things like file type and icon. It will also cause your anti-virus software to scan all those files, even if only to determine whether or not they should be scanned.

I suggest you simply open a command prompt, either disable your AV software or tell it not to go anywhere near the folder in question and run del foldername/*. Then go away and do something else for as long as this takes to run.

Of course it would be a lot quicker to simply restore the entire system from backup.

Edit

If you feel like living a little dangerously you can download Nuke.com, which will delete those files even faster. Run it from the command prompt as nuke foldername. It won't work on a root folder (by design) but otherwise just gets on with the job without asking for confirmation, so be very sure of what you tell it to nuke. There's a possibility it might fail or even crash when used on really long path names because it was originally created for win95 and I've never updated it.

Solution 2:

del /s /f /q [folder] from a command prompt. It takes a while but eventually it will get the job done.

Disabling the viruscanner might speed it up a bit, but is maybe not possible for you.

Whatever you do: Don't use Explorer or a GUI file-manager. Just building the file-list for display purposes may cause an out-of-resources issue, crashing the server completely.