RMDIR (DOS Command)
   HOME

TheInfoList



OR:

In computing, rmdir (or rd) is a command which will remove an empty directory on various operating systems.


Implementations

The command is available in Unix (e.g. macOS, Solaris, AIX,
HP-UX HP-UX (from "Hewlett Packard Unix") is Hewlett Packard Enterprise's proprietary implementation of the Unix operating system, based on Unix System V (initially System III) and first released in 1984. Current versions support HPE Integrity Ser ...
), Unix-like (e.g.
FreeBSD FreeBSD is a free and open-source Unix-like operating system descended from the Berkeley Software Distribution (BSD), which was based on Research Unix. The first version of FreeBSD was released in 1993. In 2005, FreeBSD was the most popular ...
, Linux), DOS, Digital Research FlexOS, IBM OS/2,
Microsoft Windows Windows is a group of several proprietary graphical operating system families developed and marketed by Microsoft. Each family caters to a certain sector of the computing industry. For example, Windows NT for consumers, Windows Server for serv ...
or
ReactOS ReactOS is a free and open-source operating system for amd64/i686 personal computers intended to be binary-compatible with computer programs and device drivers made for Windows Server 2003 and later versions of Windows. ReactOS has been noted a ...
operating systems. On MS-DOS, the command is available in versions 2 and later. DR DOS 6.0 also includes an implementation of the command.DR DOS 6.0 User Guide Optimisation and Configuration Tips
/ref> It is also available in the
open source Open source is source code that is made freely available for possible modification and redistribution. Products include permission to use the source code, design documents, or content of the product. The open-source model is a decentralized sof ...
MS-DOS emulator DOSBox and in KolibriOS. The numerical computing environments MATLAB and GNU Octave include an rmdir function with similar functionality.


Usage


Unix, Unix-like

Normal usage is straightforward: rmdir name_of_directory where name_of_directory corresponds with the name of the directory one wishes to delete. There are options to this command such as -p in Unix which removes parent directories if they are also empty. For example: rmdir -p foo/bar/baz will first remove baz/, then bar/ and finally foo/ thus removing the entire directory tree specified in the command argument. rmdir will not remove a directory if it is not empty in UNIX. The command will remove a directory and all its contents recursively. For example: rm -r foo/bar/baz rm -rf foo/bar/baz


DOS, OS/2, Windows, ReactOS

Normal usage is identical to Unix-like operating systems: rmdir name_of_directory The equivalent command in MS-DOS and earlier (non-NT-based) versions of Microsoft Windows for deleting non-empty directories is . In later version of Windows: rd /s directory_name Windows based on the NT kernel (XP, Vista, 7, 8, Server 2003/2008) are
case insensitive In computers, case sensitivity defines whether uppercase and lowercase letters are treated as distinct (case-sensitive) or equivalent (case-insensitive). For instance, when users interested in learning about dogs search an e-book, "dog" and "Dog" a ...
, just like their earlier predecessors, unless two files of the same name and different case exist. Then case sensitivity applies when selecting which file to use, or if the case does not match either file, one may be chosen by Windows. Having two files named the same with different case sensitivity is allowed either when Windows Services for Unix is installed or when the Windows Registry settings are set to allow it. An example of the security risk is: Using rd/rmdir and two directories with the same name and different case sensitivities exist, one of which contains valid data and/or programs, and the other contains incriminating materials and/or
malware Malware (a portmanteau for ''malicious software'') is any software intentionally designed to cause disruption to a computer, server, client, or computer network, leak private information, gain unauthorized access to information or systems, depri ...
. If rd/rmdir gets executed without regard to case sensitivity and Windows chooses the legitimate folder to delete, the only folder left is the undesired one. Windows then uses this folder instead of the previously legitimate one to execute programs, and one may be led to believe it contains legitimate data.


See also

* List of Unix commands * List of DOS commands


References


Further reading

* * * *


External links

*
rmdir , Microsoft Docs
{{Windows commands Unix SUS2008 utilities Unix file system-related software Internal DOS commands MSX-DOS commands OS/2 commands ReactOS commands IBM i Qshell commands Windows administration