Deletes (removes) a directory.
Before you can delete a directory, you must delete its files and subdirectories. The directory must be empty except for the "." and ".." symbols.
RMDIR [/S] [/Q] [drive:]path [...]
RD [/S] [/Q] [drive:]path [...]
For information about creating a directory, see the
For information about hidden files, see the ATTRIB command and the DIR command (the /A switch).
For information about deleting files, see the DEL command.
For information about deleting a directory, its files, and all subdirectories and files subordinate to it, see the DELTREE command.
CD - Create folder(s).
Equivalent Linux BASH commands:
rmdir - Remove folder(s).
You cannot delete a directory that contains files, including hidden or system files. If you attempt to do so, the operating system displays the message:
Invalid path, not directory, or directory not empty
Use the DIR command to list hidden and system files and the ATTRIB command to remove hidden and system attributes from files. For more information, see those commands.
If you insert a backslash (\) before the first directory name in path, the operating system treats the directory as a subdirectory of the root directory--regardless of your current directory. If you do not insert a backslash before the first directory name in path, the operating system treats the directory as a subdirectory of the current directory.
You cannot use RMDIR to delete the current directory. You must first change to a different directory (not a subdirectory of the current directory) and then use RMDIR with a path. If you attempt to delete the current directory, the operating system displays a message in the format:
Attempt to remove current directory - drive:path
The operating system also displays this message if you attempt to delete a directory that has been redirected by using the SUBST command.
To delete a directory named \USER\SMITH, first ensure that the directory is empty, as in:
DIR \USER\SMITH /A
The operating system should display only the "." and ".." symbols.
Then, from any directory except \USER\SMITH, type:
You can type with the same result:
You can remove several folders in one command by listing the pathname to each NT4:
RD c:\docs\Jan "c:\My Documents\Mar"