Jump to content
 







Main menu
   


Navigation  



Main page
Contents
Current events
Random article
About Wikipedia
Contact us
Donate
 




Contribute  



Help
Learn to edit
Community portal
Recent changes
Upload file
 








Search  

































Create account

Log in
 









Create account
 Log in
 




Pages for logged out editors learn more  



Contributions
Talk
 



















Contents

   



(Top)
 


1 Implementations  





2 Usage  



2.1  Unix, Unix-like  





2.2  DOS, OS/2, Windows, ReactOS  







3 See also  





4 References  





5 Further reading  





6 External links  














rmdir






العربية
Беларуская
Čeština
Deutsch
فارسی
Français

Italiano
עברית

Magyar

Polski
Português
Română
Русский
Türkçe
Українська

 

Edit links
 









Article
Talk
 

















Read
Edit
View history
 








Tools
   


Actions  



Read
Edit
View history
 




General  



What links here
Related changes
Upload file
Special pages
Permanent link
Page information
Cite this page
Get shortened URL
Download QR code
Wikidata item
 




Print/export  



Download as PDF
Printable version
 
















Appearance
   

 






From Wikipedia, the free encyclopedia
 


rmdir / rd
Original author(s)Ken Thompson, Dennis Ritchie
(AT&T Bell Laboratories)
Developer(s)Various open-source and commercial developers
Operating systemUnix, Unix-like, DOS, MSX-DOS, FlexOS, OS/2, Windows, ReactOS, KolibriOS
PlatformCross-platform
TypeCommand

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

Implementations

[edit]

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

It is also available in the open source MS-DOS emulator DOSBox and in KolibriOS.[7] The numerical computing environments MATLAB and GNU Octave include an rmdir function with similar functionality.[8][9]

Usage

[edit]

Unix, Unix-like

[edit]

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 rm 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

[edit]
The ReactOS rmdir command

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 deltree.

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, 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 also

[edit]

References

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

    [edit]
    [edit]
    Retrieved from "https://en.wikipedia.org/w/index.php?title=Rmdir&oldid=1180333332"

    Categories: 
    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
    Hidden categories: 
    Articles with short description
    Short description is different from Wikidata
     



    This page was last edited on 16 October 2023, at 00:05 (UTC).

    Text is available under the Creative Commons Attribution-ShareAlike License 4.0; additional terms may apply. By using this site, you agree to the Terms of Use and Privacy Policy. Wikipedia® is a registered trademark of the Wikimedia Foundation, Inc., a non-profit organization.



    Privacy policy

    About Wikipedia

    Disclaimers

    Contact Wikipedia

    Code of Conduct

    Developers

    Statistics

    Cookie statement

    Mobile view



    Wikimedia Foundation
    Powered by MediaWiki