Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm looking for a command line utility to delete NTFS files and directories. And I want it to work: close handles, recurse, never fail, never quit, super-kill stubborn holders of handles, everything.

Any suggestions?

share|improve this question
Just be aware that trying to do what you're after can result in an unstable or frozen system. – John Gardeniers Jan 6 '10 at 3:15

Try this out-if the files are locked sometimes the ONLY way to delete them is during a reboot:

share|improve this answer
yeah, i was sort of afraid of that. – Matt Hinze Jan 6 '10 at 2:17
There is no way around the reboot for certain deletes. This can cause slightly confusing scenarios where a file still "appears" to be present but it's gone. You will get "Access Denied" errors (IIRC) if you attempt to do anything to them while they are in limbo waiting for the reboot. – Helvick Jan 6 '10 at 7:03

You didn't specify if its something that has to be done at a specific time or if you just need files deleted that are stubborn.

What about Movefile from sysinternals? It schedules up the deletion (just set the destination as "" to delete) to occur during reboot before anything can get a handle on the files:

And it is a commandline application so easily scripted in.

share|improve this answer
thanks, i'll try that out. it doesn't need to be scheduled, i actually plan to use it in scripts. – Matt Hinze Jan 6 '10 at 2:17

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.