CMD: Delete Folder (Force `RMDIR`) – Windows

The rm -rf command in Linux is used to force the deletion of folders and their contents recursively.

The rmdir command is a Windows rm equivalent in a Windows command prompt (CMD), that also can be used to force the folders deletion with all their contents.

In this note i will show how to force the rmdir command to delete folders and their contents recursively without throwing any errors like “The directory is not empty” or “Access is denied“.

Cool Tip: Windows touch command equivalent in CMD and PowerShell! Read more →

Grep Command in Windows

If you try to delete a non-empty folder from the Windows command prompt (CMD) you will get the error as follows:

The directory is not empty.

To force the rmdir command to delete this folder, execute it as follows:

C:\> rmdir /s /q <folder>

The rmdir command parameters used to force the deletion:

Option Description
/s Delete the folder with all the sub-folders and files in it.
/q Don’t prompt for a confirmation.

If while trying to delete a folder you are getting the “Access is denied“, launch the CMD as an administrator, for this press the ⊞ Win keybutton to open the “Start” menu, type in cmd to search for the Windows command prompt and press the Ctrl + Shift + Enter.

Cool Tip: Delete a file or a folder that is open in another program! Read more →

Leave a Reply