Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

rmdir

From Wikipedia, the free encyclopedia
Directory management command on various operating systems
rmdir / rd
Example ofrmdir
Original author(s)Ken Thompson,Dennis Ritchie
(AT&T Bell Laboratories)
Developer(s)Variousopen-source andcommercial developers
Operating systemUnix,Unix-like,DOS,MSX-DOS,FlexOS,OS/2,Windows,ReactOS,KolibriOS
PlatformCross-platform
TypeCommand

In computing,rmdir (orrd) is acommand which will remove an emptydirectory on variousoperating systems.

Implementations

[edit]

The command is available inUnix (e.g.macOS,Solaris,AIX,HP-UX),Unix-like (e.g.FreeBSD,Linux),DOS,Digital ResearchFlexOS,[1]IBMOS/2,[2]Microsoft Windows[3] orReactOS[4] operating systems. OnMS-DOS, the command is available in versions 2 and later.[5]DR DOS 6.0 also includes an implementation of thermdir command.[6]

It is also available in theopen source MS-DOSemulatorDOSBox and inKolibriOS.[7] Thenumerical computing environmentsMATLAB andGNU Octave include anrmdir function with similar functionality.[8][9]

Usage

[edit]

Unix, Unix-like

[edit]

Normal usage is straightforward:

$rmdirname_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-pfoo/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. Therm command will remove a directory and all its contents recursively. For example:

$rm-rfoo/bar/baz$rm-rffoo/bar/baz

DOS, OS/2, Windows, ReactOS

[edit]
TheReactOSrmdir command

Normal usage is identical to Unix-like operating systems:

>rmdir name_of_directory

The equivalent command inMS-DOS and earlier (non-NT-based) versions of Microsoft Windows for deleting non-empty directories isdeltree.

In later version of Windows:

>rd /s directory_name

Windows based on theNT kernel (XP, Vista, 7, 8, Server 2003/2008) arecase 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 whenWindows Services for Unix is installed or when theWindows 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/ormalware. 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

[edit]

References

[edit]
  1. ^"Manual"(PDF).www.bitsavers.org. 1986. Archived fromthe original(PDF) on 2010-08-08. Retrieved2020-09-12.
  2. ^"Help page".www.jatomes.com. Retrieved2020-09-12.
  3. ^"Microsoft TechNet Rmdir article". 31 August 2016.
  4. ^"reactos/reactos".GitHub. 3 January 2022.
  5. ^Wolverton, Van (2003).Running MS-DOS Version 6.22 (20th Anniversary Edition), 6th Revised edition.Microsoft Press.ISBN 0-7356-1812-7.
  6. ^DR DOS 6.0 User Guide Optimisation and Configuration Tips
  7. ^"Shell - KolibriOS wiki".wiki.kolibrios.org.
  8. ^"Remove folder - MATLAB rmdir".www.mathworks.com.
  9. ^"Function Reference: rmdir".octave.sourceforge.io.

Further reading

[edit]

External links

[edit]
Wikibooks has a book on the topic of:Guide to Windows Commands
The WikibookGuide to Unix has a page on the topic of:Commands
File system
Processes
User environment
Text processing
Shell builtins
Searching
Documentation
Software development
Miscellaneous
File system
Text utilities
Shell utilities
Ecosystem
Interpreters
Terminals
File system navigation
File management
Archiving
Disk management
Processes
Registry
User environment
File contents
Scripting
Networking
Maintenance and care
Boot management
Software development
Miscellaneous
Retrieved from "https://en.wikipedia.org/w/index.php?title=Rmdir&oldid=1180333332"
Categories:
Hidden categories:

[8]ページ先頭

©2009-2025 Movatter.jp