Delete files in batches of 5,000 ?

I have a windows 2008 file server in a VM with 500,000 files in a particular folder.
I need to get rid of them, but if I select more than say 5,000 then delete, the CPU goes to 100% and it stops responding for hours.

Question:

Any way I could automate the task of selecting 5,000 files at time, and pressing delete?

The timestamps are all pretty much the same, so I can't do it by timestamp.
The sames are too similar, so trying to delete A*.* , then B*.* wouldn't work.

The folder in question is the kasperky quarantine folder, so in order for me to remove the folder, I'd have to boot into safe mode on Sunday.  I could probably be done the manual process by then, but at this point, I'm just curious if there's a better option for the 5,000 batch deletes.


Curiously,
Mike


mike2401Asked:
Who is Participating?
 
mike2401Author Commented:
Yes, same thing happened.

BTW: I just got word from our Lan Admin guy that they are indeed all deleted now.  As the number decreased, he was able to delete more in each batch.  By the end, he was up to 30,000 in each batch.

BTW, what is proper expert exchange etiquette to handle this issue?

(I do appreciate your interest and willingness to reply).

Mike
 
0
 
wdosanjosCommented:
Try deleting the whole folder instead.  Something like this from the command prompt:  (deletes the folder, then recreates it)

rmdir /q /s C:\YourFolder
mkdir C:\YourFolder

Open in new window


Alternatively you can just delete the files, but that should take longer:
del /q /s C:\YourFolder

Open in new window

0
 
wdosanjosCommented:
Sorry, I just re-read your question indicating that you cannot delete the folder.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
CodeCruiserCommented:
Did you try deleting files from the command prompt?
0
 
wdosanjosCommented:
I think you should request the question to be closed, indicating that you found the solution on your own.
0
 
CodeCruiserCommented:
You can just delete this question.
0
 
mike2401Author Commented:
What is the mechanism to do this?  I only see a "accept as solution" button?

Thanks, and sorry for being such a newbie
0
 
CodeCruiserCommented:
0
 
mike2401Author Commented:
thank you
0
 
mike2401Author Commented:
no real solution, just deleted manually.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.