rmdir(CMD) 19 June 1992 rmdir(CMD) Name rmdir (rd) - delete move) a directory Syntax rmdir [drive:]path rd [drive:]path Description Before you can delete a directory, you must delete its files and sub- directories; the directory must be empty except for the ``.'' and ``..'' symbols. Parameter [drive:]path Specifies the location and name of the directory you want to delete. Notes 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 message: Invalid path, not directory, or directory not empty Use the dir(CMD) command to list hidden and system files and the attrib(CMD) 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 direc- tory) 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. Example To delete a directory named \USER\SMITH, first ensure that the directory is empty, as in 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 Related commands For information about creating a directory, see the mkdir(CMD) command. For information about hidden files, see the attrib(CMD) command and the dir(CMD) command (the /a switch).