File Explorer is the default file management application in Windows. It allows you to browse, open, copy, move, and delete files and folders on your PC. However, sometimes you may find that you are unable to delete a file or folder in File Explorer. There are several potential reasons why you can’t delete files in File Explorer.
The file is in use or open
One of the most common reasons why you can’t delete a file in File Explorer is because the file is currently in use or open. If a program has a lock on the file, Windows will not allow you to delete it until that program closes the file. For example, if you have a Word document open, you won’t be able to delete the Word document file until you close Word. Files that are in use by system processes can also sometimes prevent deletion.
You don’t have permission to delete the file
In order for you to delete a file or folder in Windows, your user account must have the necessary permissions. If you receive an “Access Denied” error when attempting to delete something in File Explorer, it’s likely you don’t have permission.
On Windows computers with multiple user accounts, the default permissions may prevent Standard or Limited users from deleting files they did not create. Administrators usually have full control. You can check the Security tab on a file or folder’s Properties to see your permissions.
The file is marked read-only
Another potential reason you can’t delete a file in File Explorer is because the Read-only attribute is checked. Read-only files cannot be deleted until this attribute is unchecked. You’ll need to uncheck Read-only in the file’s Properties > General tab first before deletion will be allowed.
The file is hidden
Hidden files may also resist deletion in File Explorer. To delete a hidden file, you’ll first need to unhide it. Go to View > Options > Change folder and search options in File Explorer. Then go to the View tab and check “Show hidden files, folders, and drives.” Now you should be able to see and delete the hidden file.
The file is corrupted
If a file has become corrupted on your system, Windows may block it from being deleted. Attempting deletion may produce error messages related to an “unspecified error” or “sharing violation.” Unfortunately, there is no easy fix for a corrupted file. You may need to use the Command Prompt to force deletion.
You deleted the file, but it’s still in the Recycle Bin
When you delete a file in File Explorer, by default it gets moved to the Recycle Bin rather than permanently deleted. So even though the file disappears from File Explorer, it still exists in the Recycle Bin. To permanently remove the file from your system, empty the Recycle Bin.
How to force delete files in File Explorer
If you’ve encountered a file that refuses to be deleted through the standard File Explorer delete procedures, there are a couple ways you can force deletion:
- Restart your computer and try deleting the file again before opening other programs that may be locking it.
- Use a third party file deletion tool that is designed to delete stubborn files.
- Delete the file via the Command Prompt using the DEL command. This method can force delete read-only, hidden, and locked files.
Delete a file via Command Prompt
Follow these steps to delete a file using the Command Prompt DEL command:
- Open the Command Prompt as administrator.
- Navigate to the folder containing the file you want to delete. For example, to delete C:\Folder\File.txt you would type:
cd C:\Folder
- Type the DEL command along with the file name:
del File.txt
- Press Enter. The file will be deleted regardless of permissions or attributes.
Why can files refuse to delete in Windows?
Now that we’ve gone over some troubleshooting steps to force file deletion, you may be wondering why Windows sometimes stubbornly refuses to let you delete a file. Here are some of the main reasons behind undefeatable files in Windows:
File locking
The most common culprit for undeleteable files is open handles or file locks from running programs. Any program that has a file open is locking access to that file, preventing its deletion and modification until the program closes. Windows permits only one program at a time to have write access to a file.
Permissions restrictions
Standard user accounts don’t have full control permissions in Windows by default. Important system files are usually restricted only to the root Admin account. So if you’re logged into a Standard user account, you may not have the permissions necessary to delete certain protected system files.
Malware/virus infection
Malware and viruses sometimes attack files in a way that prevents normal deletion. Malicious programs may intentionally lock files or corrupt them to frustrate your efforts to clean an infection. In this case, malware removal software is usually required to restore normal file operations.
Pending writes
Programs may perform file operations asynchronously, with writes pending in the background before completing. Even if the program appears closed, background pending writes can sometimes still lock a file against deletion temporarily until completed.
Indexing/search services
The search and indexing services in Windows may sometimes put temporary locks on files, preventing deletion. For example, if you attempt to delete a file while Windows Search is indexing that location, you may get errors about the file being in use or locked.
Drive errors
If there are file system errors on your drive, Windows may have trouble deleting files properly. Hard drive errors can lead to corruption and unstable file operations. A SFC scan can help repair system file errors.
How to avoid file deletion issues
While the occasional difficult-to-delete file is normal, if you regularly have trouble deleting files in Windows, here are some tips to avoid file deletion problems:
- Close software before deleting its files. Don’t attempt to delete a file while it’s open in a program.
- Check for malware infections if you notice widespread file deletion difficulties.
- Log into an Administrator account if you need to delete system protected files.
- Disable indexing and search services temporarily if they are locking files.
- Repair drive errors with CHKDSK or SFC scans.
- Don’t overload your drive, leave at least 20% free space.
Recover deleted files
If you find that you have accidentally deleted an important file in File Explorer, don’t panic. As long as you didn’t bypass the Recycle Bin, you may still be able to recover deleted files easily:
- Check the Recycle Bin – Restore accidentally deleted files from here if available.
- Use Previous Versions – Recover from shadow copies if System Restore was enabled.
- Use file recovery software – Advanced tools can help recover deleted files even if you emptied the Recycle Bin.
Recovering files is usually successful if you act quickly before the file’s disk space is overwritten by new data.
Conclusion
While the occasional difficult-to-delete file is expected, if you can’t delete files in File Explorer regularly it signifies a bigger problem. Troubleshooting steps like closing open programs, verifying permissions, unhiding hidden files, running SFC and CHKDSK scans may help resolve persistent file deletion issues. Using Command Prompt DEL commands can force delete stubborn files. Ultimately, prevention is ideal by avoiding malware, maintaining your drive health, leaving sufficient free space, and not overtaxing system resources. With proper system care and recovery tools, even deleted files can usually be retrieved if needed.