How to Delete Old Folders in Windows CMD

By Gareth Downes-Powell

Although almost all Windows file operations are carried out through Windows Explorer, in some cases you may need to carry out operations at a Windows command prompt working in DOS mode. This is especially relevant if your computer will not boot, and you need to use the Windows recovery mode. To remove folders from the command prompt, the "rd" command is used, which is short for remove directory. When the command is run it will delete the chosen directory and any files or folders it contains.

Step 1

Click on the Windows "Start" button and select "Command Prompt" from the "Accessories" menu to start the Windows command prompt.

Step 2

Change to a directory outside of the directory you are going to delete; otherwise the directory will be locked, and you will not be able to remove it.

Step 3

Type "rd \path\to\directory /s", replacing "\path\to\directory" with the path to the directory you want to delete, for example:rd C:\myDirectory /sThis will remove the directory "myDirectory" from the C driver. The "/s" switch tells Windows to remove the contents of the directory if it's not empty.

Step 4

Press "Y" to confirm, and the folder and all of its contents will be removed.

Tips & Warnings

  • If the directory you want to remove has a space in its name, put the path in quotation marks, for example: "C:\my directory".
  • Double check before you confirm that you are deleting the correct folder. Files and folders deleted through the command prompt cannot be recovered from the Windows Recycle bin.