rmdir

remove directory 

Command, KornShell Built-in


SYNOPSIS

rmdir [-p] directory...


DESCRIPTION

The rmdir command removes each requested directory. Each directory must be empty for rmdir to be successful.

Options

-p 

removes all intermediate components. For example,

rmdir -p abc/def/ghi

is equivalent to

rmdir abc/def/ghi
rmdir abc/def
rmdir abc


DIAGNOSTICS

Possible exit status values are:

0 

Successful completion.

1 

Failure because directory is not a directory, or because it still contains files or subdirectories.

2 

Failure because of an invalid command line option, or no directory names specified.

Non-empty directory 

means that files or other directories are found under the directory to be removed. Use rm -r to remove the directory.

No such directory 

means that the requested directory does not exist or is otherwise inaccessible.

Current directory illegal 

indicates that you should use cd to change to another directory before removing the current directory.


NOTE

rmdir is provided as both an external utility and a built-in MKS KornShell utility.


PORTABILITY

POSIX.2. x/OPEN Portability Guide 4.0. All UNIX systems. Windows 10. Windows Server 2016. Windows Server 2019. Windows 11. Windows Server 2022. Windows Server 2025.

A command of the same name comes with Windows. This command is provided as an alternative because it accepts multiple arguments and UNIX style file names.


AVAILABILITY

PTC MKS Toolkit for Power Users
PTC MKS Toolkit for System Administrators
PTC MKS Toolkit for Developers
PTC MKS Toolkit for Interoperability
PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

Commands:
mkdir, rm, sh


PTC MKS Toolkit 10.5 Documentation Build 40.