When you want to free up storage on your device, you frequently delete your files and folders then and now. However, there might be scenarios when you can’t delete the file or folder. Even if you try to repeat this delete operation multiple times, you’ll probably end up with the same error again. In such cases, you will have to force delete that file or folder.
There might be multiple reasons for Windows failing to delete the file or folder you choose. In general, the basic problem could be that the file is currently in use while you’re trying to delete it. Since the file is already open and running in some other software, Windows will lock it from modifying externally.
So closing the program or process that is accessing your file will make it possible to delete the file or folder you want.
In this guide, we’ll show you the possible causes when you can’t delete a file or folder and how to force delete a file or folder that won’t delete.
Possible Reasons Why You Can’t Delete a File or Folder
Before proceeding to force delete a file or folder, you need to understand why you’re facing this issue in the first place. There could be multiple reasons for this, but here are a few common reasons why you might be having this issue on Windows 11, 10, 8.1, 8, or 7.
- The file is open in a window or by other programs in the background.
- The file is in use performing a process or multiple processes in the background.
- Lack of proper permissions might lead to an “Access Denied” error.
- Hard Disk or Storage device unmounted when you were deleting the file.
- File is set to Read-Only and can’t be modified.
- Failure of Storage Disk or Device.
- Corrupted Storage Disk or Device.
- File or Folder is corrupted.
- Trying to Delete System File(s) that you’re not supposed to delete.
- Recycle Bin is full or corrupted.
- File or folder is infected with a virus or malware.
- In rare cases, you may see “file location not found” error, which needs to be treated differently.
5 Ways to Force Delete a File or Folder in Windows 11/10/8.1/8/7
Regardless of the reason, you can’t delete a file or folder on Windows, you can try these methods below to fix the problem. However, make sure that it is the right file or folder that you want to delete. Force deleting might not bring the file back without using distinct recovery software to perform the task.
Here’s how to force delete a file or folder on Windows that you deem is useless and aren’t able to delete.
Method 1: Close Running Programs to Force Delete Files and Folders
If your file or folder is being used by a running program, you will have to close that program before you delete the file. In other cases, if your file or the file in the folder is open in another window or by software, then you will need to close them as well.
Follow these steps below to end the programs or services which is using the files you wish to delete.
- Click on Start and type in “Task Manager,” and press the Enter key on your keyboard. Alternatively, you can also right-click on the Taskbar, and click on the Task Manager option.
- Now select the software that is using your file, and click the “End Task” button.
- If that doesn’t work, click on More Details, and select the process from the list, and click on “End Task.”
- Go back to your file location and you can now delete the file or folder normally.
Method 2: Using Command Prompt to Force Delete a File or Folder
If you still can’t delete the file even after closing the running software, then you can use Command Prompt to force delete a file or folder:
- Click on Start and type in “cmd.”
- Righ click on Command Promt and select “Run as Administrator” option.
- To force delete a file, type the command
del file_path
- To force delete a folder, type the command
rmdir /s /q folder_path
- Finally hit the Enter key to executue the command.
Make sure to replace “file_path” and “folder_path” with the actual location of your file or folder.
For Files: For example, if your file’s location is C:\Users\Amar\Desktop, and the file name is test.txt; then the command to force delete a file is del C:\Users\Amar\Desktop\test.txt
This will force delete the file from the file location you specified in the command. Double-check you enter the correct path and file name to prevent deleting important files accidentally
Make sure to include the file extension in the command, for instance, TXT, DOCX, XLS, EXE, etc. To get the path of a file, right-click on it, and select the Properties where you can copy the exact file path.
For Folders For example, if your folder location is C:\Users\Amar\Desktop\Articles, the command to force delete the folder is rmdir /s /q C:\Users\Amar\Desktop\Articles
To get the full folder/directory path, right-click on the folder, and select the Properties where you can copy the folder location as path.
Method 3: Using PowerShell to Force Delete a File or Folder
If you’re using Powershell instead of Command Prompt, run the following command to force delete any file:
remove-Item –path file_path - force
Make sure to replace “file_path” with the file location of your file. For example, if your file’s location is C:\Users\Amar\Desktop, and the file name is test.txt; then the command will be
Remove-Item –path C:\Users\Amar\Desktop\test - force
Make sure to include the file extension in the command. To get the path of a file, right-click on it, and select the Properties. The command to run is the same for force deleting both files and folders.
Method 4: Press Shift + Delete to Force Delete a File or Folder
If you’re facing problems due to the Recycle Bin, then it’s best to use the Shift + Delete key combination to force delete the file or folder. This will bypass the Recycle Bin and delete the file permanently. This method works like a charm when your Recycler Bin is full and you can not empty the Bin for any reason.
However, this will not work against the Windows system files. They are protected from any modification or deletion and thus you can’t delete them. It’s also obvious that deleting Windows files will probably cause issues. So it’s best that you don’t delete those files.
Method 5: Use Safe Mode to Delete Files that Say “Access Denied”
When a file or folder asks for administrative permissions for deletion, then you should use the Safe Mode to force delete files and folders:
- Click on the Start Menu, and open Settings.
- Click Update and Security, and select Recovery.
- Under Advanced Startup, select Restart Now
- Once the PC restarts, click on Troubleshoot > Advanced Settings > Startup Settings > Restart.
- Once the Startup Settings appear, use the F4 or F5 key to boot into Safe Mode.
- Head over to the File or Folder that you want to delete permanently.
- Restart your Windows machine again to boot into normal mode.
Switching between Safe and Normal modes is a slow process. The boot time may take longer than usual. Have patience.
Frequently Asked Questions
It’s probably because the file is currently opened or being used by another program. To delete a file, you need to close the program which is using that file, and then try to delete the file.
If the folder contains a file that is opened in another window or is being used by another application, then you need to close the running applications in order to delete the folder.
To force delete a file, you have to open Command Prompt and type the del /f filepath command. Make sure to replace “filepath” with the actual filepath of the file that you want to delete.
When you delete a file or folder using Command Prompt or Powershell, it will be deleted permanently from your machine bypassing the Recycle Bin. You can not undo the action.
If you have accidentally run the del or remove-Ite command with the wrong path, you can not bring back the deleted file easily. They will be deleted permanently and you can not find them in Recycle Bin too. The only possible way is to try data recovery software but the probability of getting the file back is never 100%.
Also Read: How to Completely Uninstall Software and Remove Leftovers on Windows
Force delete files if Windows won’t delete them
We hope this guide helped you in force deleting files and folders that can’t be deleted on your PC and other storage devices. In most cases, you will have the problem resolved with Method 1, and this is our first choice as well.
Other methods mentioned in this guide will also work for you if one doesn’t. Moreover, always remember that once you use force delete on any files, you can’t restore them back. So make sure you double-check the file and folder paths in commands before executing them.