Home > Commands N-Z > Commands R


Description | Syntax | Parameters | Switches | Related | Notes | Examples | Errorlevels | Availability

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 [...]

drive: ( path v2.0 Win95 NT3.5)
Specifies the location and name of the directory you want to delete.
Place any long pathnames in double quotes.

/? (NTXP)
Displays help.
/Q (NT4)
Quiet - do not display YN confirmation.
/S (NT3.5)
Delete all files and subfolders in addition to the folder itself. Use this to remove an entire folder tree (formerly DELTREE).


For information about creating a directory, see the MKDIR command.
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).

Cannot delete directory with hidden or system files

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.

Using the backslash character with the path parameter

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.

Deleting 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:


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"



v2.0 v2.01 v2.05 v2.10 v2.11 v2.11R v2.12 v2.2 v2.25 v3.0 v3.20 v3.05 v3.1 v3.21 v3.25 v3.30 v3.3A v3.3R v3.3T v3.31 v3.40 v4.0 v4.01 v4.01A v5.0 v5.0A v5.00.02 v5.001A v5.01 v5.02 v6.0 v6.10 v6.2 v6.21 v6.22 v6.23 v7.00 v7.0R1 v7.10 v8.00
Win95 Win98 WinME
Windows NT
NT3.5 NT4 NT2000 NTXP NT2003