Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 239
  • Last Modified:

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


0
mike2401
Asked:
mike2401
  • 4
  • 3
  • 3
1 Solution
 
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
 
CodeCruiserCommented:
Did you try deleting files from the command prompt?
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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:
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

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 4
  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now