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.

5 of 5 0 (100%) 1 vote
- Cheers!


Written by:
Oliver is the founder and lead editor of this site. He is interested in finding new ways to break Windows, find common errors and help others to fix them. Aside from that, he loves to fully customize systems with Rainmeter and Dreamscene, find out more about ancient civilizations like the Chachapoya, sharpen his digital photography skills and create software with a small group of selected developers. If you would like to connect with him to discuss anything, send him a mail!

Learn More About.Me

Follow me on Twitter for daily updates: Twitter Follower

Contact The Author:
support@windows7themes.net

Get Free Help

Connect With Our Site:

 

   


Need help? Ask a question at our QA site, click the red button to get started:
Want to support us? Great, simply buy your favorite games from G2A via our referral link (g2a.com/r/win7themes) and save money at the same time:

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Current day month ye@r *