How to purge an extremely large folder

March 22, 2011 at 13:07:59
Specs: Windows Server 2003
We've been losing space on our 2003 server and recently discovered the cause. Temporary files (being saved as word documents) had been accumulating in a hidden folder for, well, years. The individual files are small - about 3-4k each - but there are so many of them and the size of the folder is so astronomically high at this point (approaching 400gb) that the server crashes if we attempt to interact with it. I'm no math expert, but that's a LOT of files.

This is a 100% uptime, high-traffic server with a critical function and it's been dictated to me that downtime must be a last resort. So I wanted to ask if any of you out there know of any utilities I could run to purge the folder's contents, hopefully one that can do the job without hogging the CPU and doesn't require downtime. Because of the way the server choked last time I tried to inspect the folder, I'm hesitant to even approach it from command line.

Fortunately the source problem has been corrected, so at least the problem isn't getting worse. But we're dangerously low on disk space and this folder needs to be purged.


See More: How to purge an extremely large folder

Report •

March 22, 2011 at 13:39:12
When you say that the server choked last time you tried to inspect the folder, do you mean using Explorer or using the command line? I'm guessing that you mean the former (because you use the word "folder" and people normally talk about "directories" when referring to the command line). I would recommend that you only use the command line to try to delete these folders.

I would suggest (I'm not in the same situation as you, so I can't test it, but it's the best I can think of):

1. Open a command prompt.
2. Open Task Manager.
3. Reduce the priority of the command prompt to "Low".
4. Go back to the command prompt.
5. Change to the directory above the problem one.
6. Type "rmdir /s /q <directoryname>".
7. Minimize the command prompt and leave it to do its thing.

Obviously you'll need to leave the session logged on whilst the command does its thing. With the number of files you have it's going to take a long time but, hopefully, lowering the priority of the process should stop it interfering with the system too much.

I'd still expect some performance hit whilst it's doing its thing, because of the disk access, but it's the best I can think of.

If you decide to try this you will obviously pick the least inconvenient time should it still affect the system. But, hopefully, if you still have Task Manager open you could kill the process should it cause too much of a problem.

Report •

March 22, 2011 at 13:59:15
I would suspect the issue encountered was trying to view the contents via explorer.

I would suggest just going to the cmd prompt, navigate to the folder and then issue the del *.* command and delete everything.

Delete will take some time and this assumes no subfolders. I would do this during a off peak time as this will take some server cpu cycles and anthing accessing the disk will be slower until the operation completes.

Answers are only as good as the information you provide.
How to properly post a question:
Sorry no tech support via PM's

Report •
Related Solutions

Ask Question