Find out why you can’t delete a file on Windows

Cedrick Collomb has a handy utility called Unlocker which will tell you which processes are preventing you from deleting a file or folder.

If a delete fails, you get the generic access denied error message from Windows; however, if you have Unlocker installed, then it will popup and display the processes which have a lock on the file or folder.

For example, attempting to delete C:\Windows\System32\user32.dll (yes this would be a dumb thing to do) will display the following list of processes (which will be almost everything running on Windows):

Unlocker displaying list of processes which have a lock on C:WindowsSystem32user32.dll

Unlocker allows you to force the file to be unlocked, or even kill the processes; however, I prefer to find out which processes are preventing the deletion and closing them myself.

One common issue, is that you have an editor active, but no files currently being edited, and you can’t delete the folder which contained files you just recently edited.  The editor’s current directory is the one you want to delete, so Unlocker will show the editor process in its list.  So you know to exit the editor so you can delete the folder.  An alternative is to open a file from a different folder within the editor, so the current directory changes to something other than the folder you want to delete (or ones of its children).

You can run Unlocker on a file before you attempt to delete it.

It would be nice to have a Close button within Unlocker, which would politely ask the application to close, much the same way you would select Close from the system menu when you right click on the system tray’s entry for the application.

Sphere: Related Content

No comments yet.

Write a comment: