Home / Everything DOS / What Does the RD Command Do?

What Does the RD Command Do?

rmdir

What Does the RD Command Do?, The RD command (short for Remove Directory) is a DOS command used to delete folders.

Important to understand:

  • RD removes folders, not individual files
  • By default, the folder must be empty
  • It permanently removes the folder

You may also see this command called RMDIR — both work the same way.


Basic RD Command Syntax

The simplest form is:

rd foldername

Example:

rd OldReports

This removes the OldReports folder if it is empty.


How to Use the RD Command (Step by Step)

Steps:

  1. Open Command Prompt
  2. Navigate to the parent folder
  3. Type: rd TestFolder
  4. Press Enter

If the folder is empty, it is removed immediately.


Removing a Folder Using a Full Path

You do not need to be inside the folder.

Example:

rd C:\Temp\Logs

This removes the Logs folder directly.


Removing a Folder That Contains Files (Common Use)

To delete a folder and everything inside it, use:

rd /s foldername

Example:

rd /s OldBackups

Windows will ask for confirmation before proceeding.


Removing a Folder Without Confirmation (Use Carefully)

You can suppress confirmation prompts:

rd /s /q foldername

Example:

rd /s /q TempFiles

⚠️ This deletes the folder and all contents without asking.
Only use this when you are absolutely certain.


Removing Folders With Spaces in the Name

Use quotation marks.

Example:

rd "Old Project Files"

Without quotes, the command will fail.


Common RD Command Errors

“The directory is not empty”

This means:

  • The folder contains files or subfolders

Solution:

rd /s foldername

“Access is denied”

This means:

  • You do not have permission
  • Files may be in use

Try:

  • Closing any open files
  • Running Command Prompt as Administrator

Is the RD Command Dangerous?

RD can be dangerous if misused, especially with /s and /q.

Best practices:

  • Always run dir first
  • Avoid /q until confident
  • Double-check folder names
  • Never remove system folders

When in doubt, delete files individually first.


RD vs DEL (Important Difference)

  • DEL deletes files
  • RD deletes folders

You cannot delete folders with DEL alone.


What to Learn After RD

Once you understand RD, the next useful commands are:

  • TREE – view folder structures
  • ATTRIB – view and change file attributes
  • TYPE – read text files in CMD

These build confidence without high risk.


Where to Go Next

Recommended next guides:

Tagged: