Programming Field

Rd, Rmdir - DOS/Command Prompt Reference

Deletes the directory. [MS-DOS, Windows 95/98/Me] Cannot delete the directory that contains any files or directories.

Syntax

rd [/S] [/Q] <directory-path>
rmdir [/S] [/Q] <directory-path>

Options

rd, rmdir This command can be either ‘rd’ or ‘rmdir’.
<directory-path> Specifies the directory path to delete.
/S [Windows NT] Specifies this option to delete not only the directory but also its containing all files/directories. The confirmation for deletion will be prompted.
/Q [Windows NT] Specifies to skip confirmation for deletion when using ‘/S’. (Quiet mode)

Details

Rd and Rmdir are used to delete the directory. Normally Rd/Rmdir cannot delete non-empty directories, but in Windows NT series (and XP and later) by using ‘/S’ option non-empty directories can be deleted forcely.

[MS-DOS, Windows 95/98/Me] To delete non-empty directories, use Deltree program.

[Windows 2000 or later] If the directory to be deleted is a mount point, this command will unmount and then delete the directory. In this case, even if using ‘/S’, contents in the volume (mounted to specified directory) will not be deleted. (Please see also Mountvol command page.)