The rd and rmdir commands remove empty directories in MS-DOS. To delete directories with files or directories within them, you must use the deltree command. If you are running Microsoft Windows 2000 or Windows XP, use the /S option.

Availability

Rd and rmdir are internal commands that are available in the following Microsoft operating systems.

  • Availability

  • Rd and rmdir syntax

  • Rd and rmdir examples

  • All Versions of MS-DOS

  • Windows 95

  • Windows 98

  • Windows ME

  • Windows NT

  • Windows 2000

  • Windows XP

  • Windows Vista

  • Windows 7

  • Windows 8

  • Windows 10

  • Windows 11

Rd and rmdir syntax

Windows XP and later syntax

RMDIR [/S] [/Q] [drive:]path RD [/S] [/Q] [drive:]path

Windows 95, 98, and ME syntax

Removes (deletes) a directory.

  • Windows XP and later syntax.
  • Windows 95, 98, and ME syntax.

RMDIR [drive:]path RD [drive:]path

Rd and rmdir examples

rmdir c:\full

If a directory contains files or folders, you will receive “The directory is not empty.” error message if you try to use rd or rmdir. If you want to delete directories that are full, use the deltree command or if you’re using Windows 2000 or later, use the example code below with the /s switch.

rmdir c:\test

Remove the test directory, if it’s empty.

rmdir c:\test /s

Windows 2000, Windows XP and later versions of Windows can use this option with a prompt to permanently delete the test directory, subdirectories, and files. Adding the /q switch would suppress the prompt.

  • See our directory and remove definitions for further information and related links on these terms.