Template:Short description
Template:Lowercase
{{#invoke:Infobox|infobox}}Template:Template other{{#invoke:Check for unknown parameters | check | showblankpositional=1
| unknown = Template:Main other
| preview = Page using Template:Infobox software with unknown parameter "_VALUE_"|ignoreblank=y
| AsOf | author | background | bodystyle | caption | collapsetext | collapsible | developer | discontinued | engine | engines | genre | included with | language | language count | language footnote | latest preview date | latest preview version | latest release date | latest release version | latest_preview_date | latest_preview_version | latest_release_date | latest_release_version | licence | license | logo | logo alt | logo caption | logo upright | logo size | logo title | logo_alt | logo_caption | logo_upright | logo_size | logo_title | middleware | module | name | operating system | operating_system | other_names | platform | programming language | programming_language | released | replaced_by | replaces | repo | screenshot | screenshot alt | screenshot upright | screenshot size | screenshot title | screenshot_alt | screenshot_upright | screenshot_size | screenshot_title | service_name | size | standard | title | ver layout | website | qid
}}Template:Main other
In computing, rmdir
(or rd
) is a command which will remove an empty directory on various operating systems.
ImplementationsEdit
The command is available in Unix (e.g. macOS, Solaris, AIX, HP-UX), Unix-like (e.g. FreeBSD, Linux), DOS, Digital Research FlexOS,<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref> IBM OS/2,<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref> Microsoft Windows<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref> or ReactOS<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref> operating systems. On MS-DOS, the command is available in versions 2 and later.<ref name="RUNNINGMSDOS">Template:Cite book</ref> DR DOS 6.0 also includes an implementation of the <syntaxhighlight lang="text" class="" style="" inline="1">rmdir</syntaxhighlight> command.<ref name="drdos6userguide">DR DOS 6.0 User Guide Optimisation and Configuration Tips</ref>
It is also available in the open source MS-DOS emulator DOSBox and in KolibriOS.<ref>{{#invoke:citation/CS1|citation
|CitationClass=web
}}</ref> The numerical computing environments MATLAB and GNU Octave include an rmdir
function with similar functionality.<ref>{{#invoke:citation/CS1|citation
|CitationClass=web
}}</ref><ref>{{#invoke:citation/CS1|citation
|CitationClass=web
}}</ref>
UsageEdit
Unix, Unix-likeEdit
Normal usage is straightforward:
<syntaxhighlight lang="shell-session"> $ rmdir name_of_directory </syntaxhighlight>
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:
<syntaxhighlight lang="shell-session"> $ rmdir -p foo/bar/baz </syntaxhighlight>
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 <syntaxhighlight lang="text" class="" style="" inline="1">rm</syntaxhighlight> command will remove a directory and all its contents recursively. For example:
<syntaxhighlight lang="shell-session"> $ rm -r foo/bar/baz $ rm -rf foo/bar/baz </syntaxhighlight>
DOS, OS/2, Windows, ReactOSEdit
rmdir
commandNormal usage is identical to Unix-like operating systems:
<syntaxhighlight lang="DOScon"> >rmdir name_of_directory </syntaxhighlight>
The equivalent command in MS-DOS and earlier (non-NT-based) versions of Microsoft Windows for deleting non-empty directories is <syntaxhighlight lang="text" class="" style="" inline="1">deltree</syntaxhighlight>.
In later version of Windows:
<syntaxhighlight lang="doscon"> >rd /s directory_name </syntaxhighlight>
Windows based on the NT kernel (XP, Vista, 7, 8, Server 2003/2008) are case insensitive, 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. 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 alsoEdit
ReferencesEdit
Further readingEdit
External linksEdit
Template:Sister project Template:Sister project
Template:Unix commands Template:Core Utilities commands Template:Windows commands