Tuesday, April 19, 2011

Deleting Stubborn Files

Deleting files should be a simple process but unfortunately some files refuse to be deleted!  There are two common reasons why some files refuse to be deleted; the first and probably most common reason is the file is in use by a running program, and the second common reason is you do not have permission to delete the file.
For files that are in use, closing the program that is using the file should be all that is necessary to allow the file to be deleted.  For example if I have Microsoft Word Document that I want to delete; but currently have it open in Microsoft Word, I first need to close Microsoft Word before I can delete the file.  If you try to delete the file with it open, Windows will warn you that file is in use and allow you to try again once the file is closed or allow you to cancel the deletion.
If closing the program still does not allow you to delete the file, or if Microsoft Word crashed (that would never happen would it?) and still registers the file in us; you may need to restart the computer.  Alternatively you can also use Windows Task Manager to attempt to close the program that may be using the file, this may or may not work.
Now, what happens if you still cannot delete the file?  There are a couple more options which I will just quickly mention.  Just be careful though as any file that requires these measures would most likely be important, such as a system file.  Try deleting the file in Safe Mode, this should guarantee any program other than Windows that might be using the file is not running.  If the file still refuses to be deleted you can try renaming or moving the file to a different folder.  If that still does not work you can try using a File Delete Utility, a quick online search should provide you with a number of utilities that might be able to do the job.  And finally if the file still refuses to be deleted it might be possible to hex the file away using a hex editor (VERY dangerous!).
For files that you do not have permission to delete (access denied), the most likely reason is that you are not logged in with an account with high enough permissions to delete a file.  For example if I am using a regular user account and I try to delete a file  that was created by an administrator account, I will most likely be denied or required to provide the appropriate administrator credentials.  In the screen shot below I have denied my user account access to the file (yep you can actually do that!).
To take it one step further, I also denied administrators access to the file; under normal circumstances the administrators should always have access to files, so you should not have to worry about this happening to you.  In the next screen shot, even though I have provided administrative access, I am still blocked from deleting the file.

No comments:

Post a Comment