Can’t delete a file in Windows? Here are eight solutions

So, you want to clean up your hard drive, but some files just cannot be deleted. Regardless of whether these files are located in a file folder or in the Recycle Bin, when you try to delete them, the same error messages keep popping up. The files are supposedly in use, impossible to access or unavailable. Fortunately, there are ways to force delete a file.

Reasons why a file cannot be deleted

There are various reasons as to why you might not be able to delete a file. Sometimes these reasons are unclear at first due to the system not providing much information about the error. However, in most cases, a Windows error message will provide you with a clear explanation. Windows often provides messages for the following errors:

  • The file or folder is still being used by a program.
  • The file or folder has already been deleted.
  • You are not authorised to delete the file or folder.
  • The program in question is frozen or unresponsive.
  • There are hidden files in the folder concerned.

Options for deleting undeletable files

To force delete a file, use one of the following methods. If the Windows error message has already given you a clear indication of the source of the error, you can immediately choose the corresponding method to be used. However, if the source of the error is unclear, there are still a few tips and tricks that can help you.

Close all programs

In most cases, the reason you cannot delete a file is quite simple. The file or a file from the folder is still open or being used by another program. You should thus follow the steps below.

Step 1: Check whether the file is open in a program such as Word, provided by Microsoft 365.

Step 2: If you can identify the program, close the open file or the entire program.

Step 3: If you cannot identify the program, you need to close all tasks. To do so, open the Task Manager using the following Windows keyboard shortcut: [Ctrl] + [Shift] + [Esc].

Step 4: Quit all programs by right-clicking on the active programs and selecting ‘End task’. However, be careful not to close the Windows File Explorer and Task Manager.

Step 5: You should now be able to delete the file or folder without a problem.

Restart the computer

If you have closed all the active programs through the Task Manager and the file still cannot be deleted, the program might be frozen or unresponsive.

Step 1: Go to the Windows icon in the lower left-hand corner of the screen and restart the computer.

Step 2: Check if the file still shows up. If it does, try to delete it again.

Remove a deleted folder

If a file or folder cannot be deleted and you receive the error message ‘Element not found’, this is most likely due to a File Explorer error. To resolve this issue, restart explorer.exe.

Step 1: Open the Task Manager using the keyboard shortcut [Ctrl] + [Shift] + [Esc].

Step 2: Find the ‘Windows Explorer’ task, right-click on it and then select ‘End task’.

Step 3: Click on the ‘File’ tab located in the upper right-hand corner of the Task Manager and then select ‘Run new task’.

Step 4: In the ‘Create new task’ window, enter ‘C:\Windows\explorer.exe’ and then click ‘OK’.

Step 5: If the file in question still shows up, delete it again.

Start in Safe Mode

In some cases, the file or folder can be deleted in Windows Safe Mode. In this restricted mode, background programs that can interfere with deletion are not started.

Step 1: Restart the computer and press the [F4] key during start-up.

Step 2: Under ‘Advanced start-up’ options, select the ‘Safe Mode’ option.

Step 3: Once Windows has started in Safe Mode, find the file, and delete it.

CMD command: del

If you still cannot delete the file, try using a Windows CMD command.

Step 1: Open the Run command line using the keyboard shortcut [Windows] key + [R].

Step 2: Open the command prompt window and enter ‘cmd’ in the command line.

Step 3: Now enter the command ‘del’ in the cmd.exe window, add a space directly after ‘del’ and then enter the name of the file to be deleted. It should look like this:

del filename.fileextension

Step 4: If you do not succeed in deleting the file this way, enter the full file path starting with the drive. It should look like this:

del \\?C:\folder\filename.fileextension

Perform an anti-virus scan

Usually, there is a harmless reason for not being able to delete a file. However, the problem can sometimes indicate the presence of malware. Check to see if the file has been infected.

Step 1: If you have not already done so, perform an update for your anti-virus program.

Step 2: Perform a complete virus scan.

Step 3: If the file is detected as malware and quarantined, delete it. Make sure it is not an important operating system file.

Step 4: If the infected file cannot be deleted, it may be malicious malware. In some cases, an undeletable critical system file may become infected. Consult an expert as you may need to reboot the system if worse comes to worst.

Empty the Windows 10 Recycle Bin to force delete the file

So, you have already moved the file to the Windows Recycle Bin, but the file still cannot be deleted from there. In this case, you will need to empty the Recycle Bin using the command prompt window.

Note

Before deleting everything, you should check whether there are any files you want to recover from the Recycle Bin.

Step 1: Open the Run window using the shortcut [Windows] key + [R]. Then enter ‘cmd’ and press [Enter].

Step 2: Enter the CMD command ‘rd /s c:\$Recycle.Bin’ and press [Enter].

Step 3: The system will now ask you to enter Y or N. Enter Y for Yes and confirm by pressing [Enter].

Step 4: All the files that were in the Recycle Bin should now be deleted.

Note

You might also encounter an issue where you have moved a file to the Recycle Bin, but the Windows Recycle Bin has disappeared. In this case, you will need to first fixthe Recycle Bin before you can empty it.

Use free tools

If all your efforts to delete the file using Windows are unsuccessful, there are free tools available that can be used to delete undeletable files. Some of these tools include:

  • MoveOnBoot
  • Unlocker
  • FileASSASSIN

Download the applications and follow the instructions in the software menu to remove listed blocked files. Keep in mind that free software tools may come with malware and privacy risks.

HiDrive Cloud Storage with IONOS!

Based in Germany, HiDrive secures your data in the cloud so you can easily access it from any device!

Highly secure
Shared access
Available anywhere

Wait! We’ve got something for you!
Get your .co.uk domain for just £1/1st year.

Enter the web address of your choice in the search bar to check its availability.
12 months for £1
then £10/year