Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Rmdir
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{Short description|Directory management command on various operating systems}} {{lowercase}} {{Infobox software | name = rmdir / rd | logo = | screenshot = Rmdir example.png | screenshot size = | caption = Example of <code>rmdir</code> | author = [[Ken Thompson]], [[Dennis Ritchie]]<br />([[AT&T Bell Laboratories]]) | developer = Various [[open-source software|open-source]] and [[commercial software|commercial]] developers | released = | latest release version = | latest release date = | operating system = [[Unix]], [[Unix-like]], [[DOS]], [[MSX-DOS]], [[FlexOS]], [[OS/2]], [[Microsoft Windows|Windows]], [[ReactOS]], [[KolibriOS]] | platform = [[Cross-platform]] | genre = [[Command (computing)|Command]] | license = | website = }} In computing, '''<code>rmdir</code>''' (or '''<code>rd</code>''') is a [[command (computing)|command]] which will remove an empty [[directory (file systems)|directory]] on various [[operating system]]s. ==Implementations== The command is available in [[Unix]] (e.g. [[macOS]], [[Solaris (operating system)|Solaris]], [[AIX]], [[HP-UX]]), [[Unix-like]] (e.g. [[FreeBSD]], [[Linux]]), [[DOS]], [[Digital Research]] [[FlexOS]],<ref>{{cite web |url=http://www.bitsavers.org/pdf/digitalResearch/flexos/1073-2003_FlexOS_Users_Guide_V1.3_Nov86.pdf |title=Manual |date=1986 |website=www.bitsavers.org |access-date=2020-09-12 |archive-date=2010-08-08 |archive-url=https://web.archive.org/web/20100808010315/http://www.bitsavers.org/pdf/digitalResearch/flexos/1073-2003_FlexOS_Users_Guide_V1.3_Nov86.pdf |url-status=dead }}</ref> [[IBM]] [[OS/2]],<ref>{{cite web |url=http://www.jatomes.com/Help/Os2Cmd.php#RD |title=Help page |website=www.jatomes.com|access-date=2020-09-12}}</ref> [[Microsoft Windows]]<ref>{{Cite web|url=https://technet.microsoft.com/en-us/library/cc754993.aspx|title=Microsoft TechNet Rmdir article|date=31 August 2016 }}</ref> or [[ReactOS]]<ref>{{Cite web|url=https://github.com/reactos/reactos|title=reactos/reactos|website=GitHub|date=3 January 2022}}</ref> operating systems. On [[MS-DOS]], the command is available in versions 2 and later.<ref name="RUNNINGMSDOS">{{Cite book|author-last=Wolverton|author-first=Van|title=Running MS-DOS Version 6.22 (20th Anniversary Edition), 6th Revised edition|date=2003|publisher=[[Microsoft Press]]|isbn=0-7356-1812-7}}</ref> [[DR DOS 6.0]] also includes an implementation of the {{code|rmdir}} command.<ref name="drdos6userguide">[https://www.4corn.co.uk/archive/docs/DR%20DOS%206.0%20User%20Guide-opt.pdf 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>{{Cite web|url=http://wiki.kolibrios.org/wiki/Shell|title=Shell - KolibriOS wiki|website=wiki.kolibrios.org}}</ref> The [[numerical analysis|numerical computing]] environments [[MATLAB]] and [[GNU Octave]] include an <code>rmdir</code> function with similar functionality.<ref>{{Cite web|url=https://www.mathworks.com/help/matlab/ref/rmdir.html|title=Remove folder - MATLAB rmdir|website=www.mathworks.com}}</ref><ref>{{Cite web|url=https://octave.sourceforge.io/octave/function/rmdir.html|title=Function Reference: rmdir|website=octave.sourceforge.io}}</ref> ==Usage== ===Unix, Unix-like=== 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 [[rm (Unix)|{{code|rm}}]] 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, ReactOS=== [[File:ReactOS-0.4.13 rmdir command 667x434.png|thumb|300px|The [[ReactOS]] <code>rmdir</code> command]] Normal 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 [[deltree|{{code|deltree}}]]. In later version of Windows: <syntaxhighlight lang="doscon"> >rd /s directory_name </syntaxhighlight> Windows based on the [[Architecture of Windows NT|NT kernel]] (XP, Vista, 7, 8, Server 2003/2008) are [[Case sensitivity|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|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 also== *[[List of Unix commands]] *[[List of DOS commands]] ==References== {{Reflist}} ==Further reading== *{{Cite book|author-last=Cooper|author-first=Jim|title=Special Edition Using MS-DOS 6.22, Third Edition|date=2001|publisher=[[Que Publishing]]|isbn=978-0789725738}} *{{Cite book|author1=Kathy Ivens|author2=Brian Proffit|year=1993|title=OS/2 Inside & Out|publisher=[[Osborne McGraw-Hill]]|isbn=978-0078818714}} *{{Cite book|first=William R.|last=Stanek|year=2008|title=Windows Command-Line Administrator's Pocket Consultant, 2nd Edition|publisher=[[Microsoft Press]]|isbn=978-0735622623}} *{{Cite book|author-last=McElhearn|author-first=Kirk|title=The Mac OS X Command Line: Unix Under the Hood|date=2006|publisher=[[John Wiley & Sons]]|isbn=978-0470113851}} ==External links== {{Wikibooks|Guide to Windows Commands}} {{Wikibooks|Guide to Unix|Commands}} *{{man|cu|rmdir|SUS}} *[https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/rmdir rmdir | Microsoft Docs] {{Unix commands}} {{Core Utilities commands}} {{Windows commands}} [[Category:Unix SUS2008 utilities]] [[Category:Unix file system-related software]] [[Category:Internal DOS commands]] [[Category:MSX-DOS commands]] [[Category:OS/2 commands]] [[Category:ReactOS commands]] [[Category:IBM i Qshell commands]] [[Category:Windows administration]]
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)
Pages transcluded onto the current version of this page
(
help
)
:
Template:Cite book
(
edit
)
Template:Cite web
(
edit
)
Template:Code
(
edit
)
Template:Core Utilities commands
(
edit
)
Template:Infobox
(
edit
)
Template:Infobox software
(
edit
)
Template:Lowercase
(
edit
)
Template:Main other
(
edit
)
Template:Man
(
edit
)
Template:Reflist
(
edit
)
Template:Short description
(
edit
)
Template:Sister project
(
edit
)
Template:Template other
(
edit
)
Template:Unix commands
(
edit
)
Template:Wikibooks
(
edit
)
Template:Windows commands
(
edit
)