WiseCleaner Think Tank
Encounter difficult computer problems?
All about maintenance and optimization of your Windows System.
Oct 25, 2024
Deleting files and folders in Windows is a common task. The system will send the deleted items to the Recycle Bin by default. This allows you to recover accidentally deleted items later.
However, if you are certain that you do not need a folder anymore and want to delete it immediately without the extra step of emptying the Recycle Bin, you could use CMD to permanently remove it and the content within it from your computer. We have discussed on how to delete files directly on Windows 11 in a previous article. In this WiseCleaner guide, we will show you how to delete a folder or the sub-folders permanently.
The rmdir command is used to directly remove a folder and every file in it using the Windows Command Prompt without confirming. Follow the steps below:
Press the Windows key + R on your keyboard, and type cmd in the text box, then click the Enter key to open the CMD app.
Type the following command in the interface of CMD, and then hit Enter. Replace FolderName with the path to the folder you want to delete.
rmdir /S /Q "FolderName”
If you want to delete only the sub-folders in a folder but leave other files inside the folder intact, you can use the for /d command in CMD. This command will go through and remove each sub-folder in a specified folder selectively, while leaving other files in the main folder. Below is how you can do it:
Open Command Prompt as an administrator by pressing the Windows key + R and entering cmd in the text box.
Run the following command in the window of CMD. Replace C:\Path\To\YourFolder with the actual path of your folder.
for /d %D in ("C:\Path\To\YourFolder\*") do @rmdir /S /Q "%D"
By following the two commands introduced in this WiseCleaner post, your data in the folder or sub-folder will be permanently removed without sending to the Recycle Bin and cannot be restored through normal means. So please use them carefully or try backing up your important data before processing.