Sometimes, Windows users find it difficult to delete folders or files in File Explorer due to different reasons.
Deleting files manually by selecting the item and using the mouse might fail to work sometime.
This is why as an alternative, you can utilize the Command Prompt to delete the folders, sub-folders and files in your computer.
Here at Outsource Path, as part of our Technical Support Services, we regularly help our Customers to fix Windows related issues.
In this context, we shall look into the causes of this error and how to resolve it.
Reasons why we delete files and folders using Command Prompt in Windows 10?
One of these reasons can be attributed to the failure that can lock down the folders or files which prevents you from deleting them.
So you can use the Command Prompt to delete the folders, sub-folders and files in your computer.
Note that when you use the Command Prompt incorrectly, it might affect your computer and render it inoperable, thus, you must be extra careful when executing the steps given below and it would also be better if you create a System Restore Point.
How to use Command Prompt to delete the folders, sub-folders and files in Windows?
To do this, follow the steps below;
1. First, in the Start Search, type "command prompt" in the field and from the search results, right click on Command Prompt and then select the "Run as administrator" option to open Command Prompt with admin privileges.
2. After opening Command Prompt as admin, navigate to the folder where the file you want to delete is located.
Note that you have to execute the "cd" or the change directory command.
3. Next, execute the following command in Command Prompt:
DEL /F /A <file path with extension>
Note: In the given command, "/F" is the force delete command, while "/A" is the command that selects the files with ready for archiving attribute.
4. After that, go to the location where you can find the folder you want to delete by using the "cd" command again. And then execute the following command right after:
RD /S <folder path>
Note: In the given command, "RD" is the command that removes the folder from the directory, while "/S" removes all of its sub-folders and files. On the other hand, if you also use the "/Q" parameter, you won't see the "Y/N" confirmation but if you didn’t use it, then simply tap the Y button to proceed.
And that's how you delete the folders and files in your computer using Command Prompt.