How to delete a folder via command prompt

Do you want to delete a folder right from the command prompt instead of deleting it manually? This is really easy and will help you to manage your PC more effectively.

Remove folder in command prompt

Command Prompt

There are two commands that you can use to delete a folder via command prompt.

  • rd
  • rmdir

Both commands are the same, but rd is shorter. I prefer rmdir because it is easier to remember and is closer to the Linux equivalent “rm” (that’s how you remove something in linux).

Tip: If you do not specify a path for the rmdir command you will have to CD to the correct directory. E.g. CD C:\delete\

Delete Folder + Subfolders And Files

If you want to delete all folders and files in a directory, you can use the option /s. The option /q will make sure that you will not be asked to confirm a deletion.

  • rmdir /s C:/path/to/folder

Examples

Delete folder from command prompt

1. Step The first line rd C:\delete\thisfolder was successful, we did not get any error message.

2. Step If you try to use the option -s (/s is correct) after CD’ing to the folder C:\delete will still remove the folder “thisfolder”, but will give you the error message The system cannot find the file specified.

3. Step rmdir /s thisfolder after CD’ing to the folder C:\delete will ask for your confirmation and will then delete the folder depending on your answer.

Twitter.png Facebook.png GooglePlus.png Pinterest.png LinkedIn.png Tumblr.png Email.png
5 of 5 0 (100%) 1 vote
- Cheers!