Generally, closing the file or its background processes solves the issue. If this does not resolve the problem, you have other options for removing the files.
Why Can’t I Delete File on Windows?
How to Fix Files Not Deleting on Windows?
Usually, minor bugs in the operating system can prevent you from deleting a file. Such bugs can get fixed with a system restart. Also, before you begin with the other fixes for this problem, try to permanently delete the file by bypassing the recycle bin. To do this, simply select the file and press the Shift + Del key. If the problem persists, try these fixes to delete the files.
End the Background Process
If the files are opened in the background, they resist getting deleted. These files remain in a locked state while they are in use. To resolve this issue, end the background processes related to the file and then try to delete it. Another possibility is that the file that refuses to be deleted is being used by another program. While attempting to delete the file, users may receive an error message stating, “The action can’t be completed because the file is opened in another program”. Deleting the file is only possible after closing the program that is using it. The resource monitor terminates the application and its other processes using the file. Finally, you will be able to delete the file.
Change the File Attribute
The files with Read-only attributes assigned to them will not grant you permission to edit, modify or delete it. You can revoke the read-only attribute assigned to the file and then delete it.
Take Ownership of the File
Having ownership over a file gives you the privilege of accessing and modifying the file. If you do not own the file, you will be unable to delete it. Using the takeown command, you can gain complete control of the file and easily delete it. Here’s how to put it to use.
Force Delete the File
Force deleting will put an end to the processes that are preventing you from deleting the file. You can use the del command to delete any file. Adding /f syntax to the command will order it to force delete the file. There’s a similar command line in powershell which also can be used to force delete a file. This command can be used to delete the file with read-only attributes or hidden ones.
Run CHKDSK Command
Files located in the bad sectors can be inaccessible or difficult to delete. Users can get a message with an error code 0x80070570 while attempting to delete such files. This error code indicates that the directory or file is corrupted. The chkdsk command is a great command-line utility that can diagnose and troubleshoot such logical errors in the drive.
Perform Malware Scan
Malware or virus-affected files can be difficult to delete. Also, Malware can sometimes mimic a file or system process and give you a hard time getting rid of it. Therefore, preventing malware infection beforehand becomes crucial. For this purpose, you can use Windows Defender or any other Antivirus software and safeguard the system. Manual scans with antivirus software are effective in protecting your files from these threats. Here’s how you can run manual scans using Windows Defender.