Command: rd / rmdir
RD / RMDIR removes (deletes) an empty directory.
Syntax:
RMDIR [drive:][path] [/?]
RD [drive:][path] [/?]
drive The drive letter where you want to delete a
directory, e.g. C:
path The pathname which already exists, e.g. if you are
already in a directory.
Options:
/? Shows the help.
Comments:
For performance reasons RD / RMDIR only overwrites the first letter of
each directory name / filename by a '?'. See DEL / ERASE or
DELTREE for more information. You can also use RD instead of RMDIR.
RMDIR will only delete empty directories (no files or directories
inside)! Do not forget to remove hidden files or directories!
In DOS directories are shown in capital letters and have NO ending.
RMDIR is a command internal to command.com and needs no other file
in order to work.
Examples:
You have a directory: C:\TEST01\TEST02\TEST03\example.txt (or more
files inside)
To delete all folders you have to do the following:
cd C:\TEST01\TEST02\TEST03
then:
del example.txt OR:
del *.* (More files inside) OR:
move example.txt C:\anywhere (Rescues file example.txt) OR:
move *.* C:\anywhere (Rescues all files)
then you have to go back step by step and delete each empty folder
cd .. (Goes back to C:\TEST01\TEST02)
rd TEST03 (Deletes folder TEST03)
cd .. (Goes back to C:\TEST01)
rd TEST02 (Deletes folder TEST02)
cd .. (Goes back to C:\)
rd TEST01 (Deletes folder TEST01)
dir (Whole folder structure is deleted)
See also:
attrib
cd/chdir
cdd
command.com/freecom
del/erase
deltree
dir
md/mkdir
move
undelete
Copyright © 2004 Robert Platt, updated 2007 and 2022 by W. Spiegl.
This file is derived from the FreeDOS Spec Command HOWTO.
See the file H2Cpying for copying conditions.