rd or rmdir
Remove (delete) a directory.
rd [/s] [/q]
pathrmdir [/s] [/q]
Unlike in Windows Explorer, files and folders are deleted
differently; if you try to use
del to delete a
directory, it will simple delete all the files in the directory, but
the directory itself will remain.
rd is used to
delete empty directories and, optionally, to delete directories and
all of their contents.
rd accepts the following options:
Specifies the directory to delete.
Removes all files and subdirectories of the specified directory.
Quiet mode; don’t prompt when using
Delete the empty subdirectory called
located in the
Delete the directory
Online Services and all of
its contents within the current directory,
rd /s "online services"
Note that quotes must be used with
rd for folders
with spaces in their names.
rmdircommands are functionally identical.
As a safety feature, attempting to delete a directory that is not empty without including the
/soption will display the message, “The directory is not empty.”
/soption takes the place of the
deltreecommand found in earlier versions of Windows, but no longer included in Windows XP.
If you try to delete the current directory, you’ll get the following error: “The process cannot access the file because it is being used by another process.” In this case, you’ll have to change to a ...