How to Delete A File or Folder in Windows.
Trying to delete a stubborn file or folder from your Windows PC can be frustrating. For example, you might click the Delete button and think that a file or folder is gone, but you might find it exactly where you deleted it.
There are several reasons why you cannot delete a file or folder, including:
- The file may be in use by another program, background process, or application.
- The file unlocking process may not have been completed.
- Disk failure or corruption.
- The folder or file is read-only or damaged.
- You may be trying to delete a system file.
- The cart is either full or damaged.
- A file or folder has been infected with malware or a virus.
- The disk is write-protected or full.
- You receive an access denied warning when you try to delete files or folders from a mapped external drive.
This guide explains how to force delete a file or folder in Windows 10 and get rid of it permanently.
How to Force Delete a File or Folder in Windows
You can force the deletion of a file or folder in Windows through Command Prompt, Safe Mode, using a keyboard shortcut, or using a third-party application. Before trying any of these methods, follow a few basic steps to work around the problem:
- Close all running applications or programs on your computer, and then delete the file or folder again …
- Use Task Manager to close the file or folder and then try deleting it again.
- Restart Windows and see if you can successfully delete the file or folder after restarting your computer.
- Run a virus/malware scan to check for threats that may be lurking on your computer.
- Check if the file or drive is marked read-only, otherwise, you will not be able to delete the file or folder. You can do this by right-clicking a file or folder and choosing Properties.
- Update Windows and then try deleting the problematic file or folder.
If the above basic steps did not resolve the issue, use the methods below to force the deletion of a file or folder in Windows.
Force Delete a File or Folder in Windows Using Command Prompt
Command Prompt on Windows PCs can perform advanced administrative functions, automate tasks with batch files and scripts, and troubleshoot problems in Windows.
How to forcibly delete a file via the command line
- Enter CMD in the search box and select “Run as administrator”.
- Type cd x: and press Enter. In this case, x represents the name of the drive letter where the folder containing the file that you want to force delete is located.
- Type del filename and press Enter. Make sure to replace the file name with the name of the file you want to delete in Windows.
Or enter the command as del / F c: users this desktop filename to force the deletion of the file if it is read-only. In this case, you must enter del plus the / F parameter, file location, and file name, which will look something like del / F c: admin this PC desktop delete this.
Note. If you use del to delete a file on Windows, you won’t be able to retrieve the file later.
How to force delete a folder using the command line
If there is a file in the folder, you can use the steps above to force the deletion of the file, and then use the command line to delete the folder. This process can be tedious and time-consuming if you have a lot of nested files and folders, but here’s how to do it quickly.
- Open Command Prompt> Run as Administrator.
- Use the / s flag with rmdir to force the deletion of a folder along with its subfolders and files. For example, if you want to delete a folder named “Test Folder”, enter rmdir / s test folder.
- If you are prompted to confirm deletion, select Y and press Enter.
Note. Any folder that you delete using the rmdir command cannot be restored.
Delete a File or Folder in Windows Using Safe Mode
Safe Mode is a diagnostic mode in which Windows starts in a basic state with a limited set of drivers and files. You can delete files or folders in Safe Mode that you might not otherwise be able to delete earlier.
Enter Safe Mode, locate the file or folder you want to delete, and then restart your computer to exit Safe Mode.
Use a Third-Party Program to Force Delete a File or Folder in Windows
If you are still unable to forcibly delete a file or folder after following the steps above, you can use a third-party program to make it easier to delete files and folders.
Unlocker is one of the best file or folder removal software that allows you to regain control of your data by unlocking files and killing unresponsive processes.
The application can terminate processes, unload DLLs, unlock, delete, rename, or move locked files without restarting the computer or deleting index.dat files. However, Unlocker can kill important processes and delete important files from Windows, so you need to be careful when using the app.
Remove Stubborn Files and Folders from Your PC
Trying to delete files and folders from your computer that cannot be deleted can be stressful. However, with the solutions suggested here, you should work around this issue and permanently delete the files or folders.
Let us know what worked for you by leaving a comment in the section below.
How to Delete A File or Folder in Windows
How to Delete A File or Folder in Windows
delete all files and folders in a directory cmd
how to delete a file on windows 10
how to delete a folder on windows 10