Tag Archive for DOS commands

Deleting folders using the command prompt

A reader asks:

“How do I delete a folder using the command prompt?”

First, for those of you who don’t know, DOS isn’t dead. The old DOS commands still work. (For those of you too young to know what DOS is, see the picture).

DOS Screen

DOS Screen

Second, to use the old DOS commands you need to bring up the “command prompt” which can be found under “Accessories” in the “Programs” menu under Start. Just click “Start” > “Programs” > “Accessories” > “Command Prompt”. A quick method I use is hold the Windows key with one hand and tap the letter “R” with the other. Then type “cmd” without the quotes, and hit ENTER. Voila!

Now, what we call “folders” in Windows today was referred to as a “directory” in DOS. So we need to use the RD or the RMDIR commands.

  • RD, which stands for ‘remove directory’, will delete an empty folder.
  • RMDIR will delete a folder and anything inside the folder.

The commands are used as follows:

  • RMDIR drive:folder_name
  • RD drive:folder_name

“Drive” is the letter assigned to the drive containing the folder. The drive letter is followed by :\

To speed things up when removing directories, you might try adding these strings to the end

  • /S Add this to remove all directories and files in the specified folder in addition to the directory itself. This is called removing a directory tree.
  • /Q Quiet mode, does not ask if its ok to remove a directory tree with /S.

So

rmdir c:\test

becomes

rmdir c:\test /s /q