How to delete locked files or folders

Reading time icon 4 min. read

Readers help support Windows Report. When you make a purchase using links on our site, we may earn an affiliate commission. Tooltip Icon

Read the affiliate disclosure page to find out how can you help Windows Report effortlessly and without spending any money. Read more

Laptop locker software

Computers are designed to be smarter than the people who use them. And for the majority of times, they indeed are, helping us to execute wildly complex tasks faster and with remarkable efficiency. But sometimes they confound us by failing to complete tasks that seem straight forward even to us.

An example is when your Windows computer refuses to delete a file or folder. Other times it will also refuse to move or rename a file. The computer will give you different reasons for refusing to delete your selected file. It will tell you:

  • The file, its source, destination or directory may be in use by another program
  • Access is denied
  • There is a sharing violation somewhere
  • That the file is unreadable or is corrupted, etc.

Of course, if the computer tells you the file is open in another program, usually one you have opened yourself, closing that program first should unlock the file or folder for deletion. That should be straight forward. But there are cases, as with some background processes, where you can’t immediately tell which program currently has the file open.

How to delete locked files

Just to be sure, Windows system files are locked for a reason. In case you end up in the Registry while trying to fix something, avoid deleting any files or folders there. If unsure what to do, consult a professional. But for locally stored files that you know are safe to delete, but for some reason won’t oblige, there are a few tricks you can try;

Solution 1 — Restart your computer

Sometimes exiting the programs you are in and restarting your computer maybe all you need to delete a stubborn file. Restarting the computer reboots your system and clears it of any temporary bugs that may have locked your file.

But when it is the Windows startup program itself that is locking your file, simply restarting the computer may not unlock it. If you notice restarting the computer isn’t doing the trick, try restarting it in safe mode and deleting the file, before considering other fixes. You can switch back to normal mode after you have deleted the file.

Solution 2 — Use Windows’ Command Prompt

A quick way to force file deletion is to go the CMD route. Open the Run dialog box, type in cmd, and hit the enter key. Once you are in command prompt, type del /f file name and press enter key.

Remember to replace file name with your own file’s name. This should delete the file. However, please note you won’t be able to retrieve the file once you have deleted it this way.

Solution 3 — Use third party file deleting software

Another way to delete a locked file is by using third party software that’s specially written for the purpose. There are several options available, but Unlocker is a popular one. Some of these will also make it painless to rename and move locked files.

Most third party software for deleting locked will require you to download and install them on your computer. However, there are others, like the Process Explorer task manager, are portable and won’t require you to install them on your machine.

Process Explorer is particularly useful as it also shows you which processes are currently running at a given time, as well as the processes’ owning accounts.

The Process Explorer software gives you greater insight into the Windows OS. Among other functions, the tool can tell which process is running any open window, suspend or kill a running process, and, importantly, figure out which process has locked the file you are trying to delete.

Any one of the solutions we have discussed here should help you delete any file you may have been struggling with and, hopefully, put you back in command of your machine again. If you find this problem cropping up repeatedly, you should consider cleaning your computer. There is always a possibility a stubborn bug or virus attack could be messing with your files.


More about the topics: files