---------------------- MS-DOS v6.22 Help: RMDIR (RD) -----------------------
<Notes> <Examples>                                               <Index>

                                 RMDIR (RD)

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 ".."


    RMDIR [drive:]path

    RD [drive:]path


    Specifies the location and name of the directory you want to delete.

Related Commands

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.


<Syntax> <Examples>


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, MS-DOS displays the following

    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,
MS-DOS 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, MS-DOS 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,
MS-DOS displays a message in the following format:

    Attempt to remove current directory - drive:path

MS-DOS also displays this message if you attempt to delete a directory that
has been redirected by using the SUBST command.


<Syntax> <Notes>


To delete a directory named \USER\SMITH, first ensure that the directory is
empty, as in the following example:

    dir \user\smith /a

MS-DOS should display only the "." and ".." symbols.

Then, from any directory except \USER\SMITH, type the following command:

    rmdir \user\smith

You can type the following command with the same result:

    rd \user\smith


<Top of page>
Last update: December 07, 2002 14:45 by
Content © 1997 Microsoft Corporation
All else © 2000-2005