The Remove Directory Command (rd)
To remove a folder, you use rd (or rmdir). By default, it acts as a safety mechanism: it only removes empty directories. If you want to delete a folder with contents, you need the /s switch.
Usage:rd
[directory]
[/s]
[/q]
directory
The folder to remove.
/s
Removes all directories and files in the specified directory in addition to the directory itself.
/q
Quiet mode, do not ask if ok to remove a directory tree with /s.
Real-World Examples
Remove an empty directory:
Command Prompt
C:\Users\User>rd OldDocs
Remove a directory tree (Folder + Contents):
Command Prompt
C:\Users\User>rd /s TempBuild
Knowledge Check
1 / 2What happens if you try to 'rd' a folder that contains files?