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 moving some files around on the server (Windows Server 2003), and there's a locked file that no one seems to have open. How do I delete this file?

share|improve this question
Be careful with solutions which close the file handle, since they might cause unpredictable corruption. See… for details. – CesarB Jul 29 '09 at 17:51
up vote 18 down vote accepted

Use the openfiles command to identify and disconnect users who have the file open. If that doesn't work, download the Unlocker utility.

Openfiles syntax:

openfiles.exe /query
openfiles.exe /disconnect /id openFileID
share|improve this answer
the link above for the Unlocker utility doesn't work, but this one does - – pro Jan 8 '10 at 10:08
Such a nice utility, too bad it's surrounded by so many "click here" links. – AlexanderN Feb 14 '12 at 20:28
1.) Open `computer management', (right-click "My Computer", select

2.) Scroll down to `Shared Folders', expand.

3.) Select/click on `Open Files'. Double/triple-check to make sure
nobody has it open.

If you're good on the above, a too-deep file/folder path might be giving you some grief. Try navigating several folders towards the root, then cutting and pasting them to reduce some of that path. Alternately, you could rename the folders in the path to "1", "2", "3", etc. Cutting down on some of the extraneous characters.

share|improve this answer

SysInternals has a tool called MoveFile that will do move or delete the file upon reboot of the machine.

MoveFile link

share|improve this answer

I see this all the time, you can also run Systernal's Process Explorer to find who has the file, here's a great how-to on using Process Explorer for this purpose: Unlocking files that are in use

I personally like this way since I have this tool on my USB drive and can run it without having to install it.

share|improve this answer
+1 Unlike 'openfiles' this will show you local processes that have files locked, not just those locked from remote. – sysadmin1138 Jun 3 '09 at 19:13
openfiles /local on will show you local open files, however you will have to reboot if it's the first time you've had to do it. – Jim B Jun 3 '09 at 20:02

As a last resort you can try booting up in "Safe Mode" or "Command Prompt" mode and deleting the file that way.

We see this a lot with viruses, spyware, etc. Booting up in safe mode usually does the trick.

Good luck!

share|improve this answer

Your Answer


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