How to Delete Undeletable Files
If you come across a file that you can't delete, don't worry - Ian Waugh explains how to delete the undeletable
Every now and again, you may try to delete a file and get a message saying the file can't be deleted. Typical messages are:
Cannot delete filexxxxx. Access is denied
Make sure the disk is not full or write-protected
and that the disk is not full.
Cannot delete filexxxxx. Access is denied Make sure the disk is not full or write-protected and that the file is not currently in use.
Cannot delete filexxxxx. It is being used by
Another person or program.
Close any programs that might be using the file
And try again.
This can happen for a variety of reasons. Typically, as the error message suggest, it's because the file is being used by a piece of software. This may often be Windows Explorer (not to be confused with Internet Explorer) or, in many cases, spyware. These 'lock' the file, preventing it from being deleted.
There are a few solutions to the problem. We'll start with the simplest:
Solution 1
Restart your computer
This might just close the errant program and let you delete the file. If it doesn't, try this:
Solution 2
Press Ctrl+Alt+Del (Control, Alt and Delete) to bring up the Windows Task Manager.
Click on the Processes Tab. This shows which process are running in the background. You might be surprised by how many there are. Some just sit there waiting to be called to action, hogging resources in the process (but that's another article altogether!).
You'll be able to tell what many are, such as iexplorer, explorer, thunderbird, winword, ipodservice and so on.
Others, however, have much more obscure names so it's not always easy to know what are safe to stop and which are not. If you're not sure, type the name into Google and you'll find out if it's malicious or not. Do be aware, however, that if you delete a file that Windows needs, your PC may throw a wobbler, crash, lock or do some other nasty thing so do take care with this.
If the process is spyware, highlight the name in the Task Manager and click on End Process. You can then, generally, delete the file. But not always. So we move on to the next options. But if you suspect there is spyware or malware onboard, you need to check out your computer thoroughly and get rid of it. We have lots of articles about this on Practical PC such as here, here or here.
Solution 3
This is really for users with a bit of PC savvy. We'll explain what to do but if you're not comfortable with it, move to the next option which is probably the best and easiest although it does involve using a special piece of software.
So, this solution can be used if Windows Explorer is, or suspected to be, locking the file and preventing it from being deleted. It involves ending the Windows Explorer process and deleting the file from DOS.
Close all programs then use the Windows Task Manager as described above to close explorer.exe. This will not crash your PC but you will lose certain functionality.
Now, in the Task Manager, go to File>New Task (Run.) type "cmd" (without the quotes) and press Enter. This opens a DOS window where you can navigate to the offending directory and file and delete it. Here are the basic DOS commands you need:
cd\ go to the drive root
cd foldername go to the specified folder
cd.. go up one directory (cd followed by two full stops)
dir list the files and folders in the current directory
dir *.* /x show the true DOS names of the files
You may need this last command because, as you may know, DOS only uses 8-character filenames so this shows the true DOS name of a file which you will need in order to delete it. And to do that, you use:
del filename deletes filename
del *.* deletes all files in the current directory
Solution 4
If a simple restart doesn't solve the problem, this may be your best and easiest bet. You need a free piece of software called Unlocker which you can download by clicking here.
Once installed, it appears in the Context Menu when you right-click on the offending file or folder. You can then unlock the offending file and delete it.
Job done!


