Back to Blog
Arnošt Havelka

The RD Command

Remove empty directories.

Start Interactive Lesson
The RD Command

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.

Try the command

Try removing a directory!

Build the command
rd
directoryThe folder to remove.
Terminal
C:\Users\User>rd EmptyFolder /s /q

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?

References

These documentation links provide authoritative details for the commands used in this article.

Up Next

Attrib Command

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