rd or rmdir


Remove (delete) a directory.


rd [/s] [/q] path
rmdir [/s] [/q] path


Unlike in Windows Explorer, files and folders are deleted differently; if you try to use del to delete a directory, it will simple delete all the files in the directory, but the directory itself will remain. rd is used to delete empty directories and, optionally, to delete directories and all of their contents.

rd accepts the following options:


Specifies the directory to delete.


Removes all files and subdirectories of the specified directory.


Quiet mode; don’t prompt when using /s.


Delete the empty subdirectory called newdir located in the c:\olddir directory:

C:\>rd c:\olddir\newdir

Delete the directory Online Services and all of its contents within the current directory, c:\Program Files:

C:\Program Files>rd /s "online services"

Note that quotes must be used with rd for folders with spaces in their names.


  • The rd and rmdir commands are functionally identical.

  • As a safety feature, attempting to delete a directory that is not empty without including the /s option will display the message, “The directory is not empty.”

  • rd with the /s option takes the place of the deltree command found in earlier versions of Windows, but no longer included in Windows XP.

  • If you try to delete the current directory, you’ll get the following error: “The process cannot access the file because it is being used by another process.” In this case, you’ll have to change to a ...

Get Windows XP in a Nutshell now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.