How to Delete a Folder using the Windows Command Line Software & Sites 30 MAY 2013

blue-folder-iconIf you find yourself stuck in the Windows Command line environment and have an itching desire to delete some of your folders, here is the command to do it: RMDIR.

If like me you are one of the older guys reading this, then you would probably have fingered the old (DOS) DELTREE as the command to use, but seeing as this was technically replaced ages ago, the correct answer is in fact RMDIR, which is responsible for removing a directory (and with switches, an entire directory tree, folders, files and all!).

Given a folder called ‘annoying’, you can banish it by running:

rmdir c:\annoying

Of course this will fail if ‘annoying’ isn’t empty. To get around this and delete the entire directory tree, in other words a recursive file and folder delete, we employ the /s switch:

rmdir /s c:\annoying

And if we don’t want to be prompted or bothered again by what is about to happen, we force the command into quiet mode with the /q switch:

rmdir /s /q c:\annoying


Related Link:

Related Posts:

About Craig Lotter

South African software architect and developer at Touchwork. Husband to a cupcake baker and father to two little girls. I don't have time for myself any more.