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.
There are two commands that you can use to delete a folder via command prompt.
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
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.
Trending On Windows Themes .Net