CMD Master
Back to Blog
Arnošt Havelka

The RD Command

Remove empty directories.

Start Interactive Lesson
The RD Command

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 / 2

What happens if you try to 'rd' a folder that contains files?

Up Next

Attrib Command

Manage file attributes like Read-only, Hidden, and System.