NAME
rmdir
—
remove directory
SYNOPSIS
rmdir |
[-pve ]
directory… |
DESCRIPTION
Removes directoryies, and, with
-p
, their parents.
OPTIONS
-p
,--parents
- Remove parents of each directory, up to the first failure.
-v
,--verbose
- Write which directories were removed to the standard output stream.
-e
,--ignore-fail-on-non-empty
- Don't error if removal failed with
ENOTEMPTY
.
EXIT STATUS
1 if a
directory (or its parent with
-p
) couldn't be removed, except if
-e
and because
ENOTEMPTY
.
SEE ALSO
STANDARDS
Conforms to IEEE Std 1003.1-2024
(“POSIX.1”). -v
and
--ignore-fail-on-non-empty
are extensions, also
present on the GNU system.
Short -e
is an extension, compatible with
the KornShell.
-v
is also available in
FreeBSD 6.0.
HISTORY
Appears in the first edition of the UNIX Programmer's Manual as rmdir(I):
NAME
rmdir -- remove directory
SYNOPSIS
rmdir dir1 ...
Version 7 AT&T UNIX merges that page into rm(1) with an updated SYNOPSIS of
rm
now forks out to rmdir
to
remove directories in -r
mode. This is standardised in
X/Open Portability Guide Issue 2
(“XPG2”).
4.2BSD and AT&T
System V Release 3 UNIX add
rmdir(2), reducing both implementations considerably.
AT&T System V Release 3 UNIX alone
adds -ps
, with -p
additionally writing any of
- "
rmdir:
directory: Whole path removed.
" - "
rmdir: Directory not empty:
directorynot removed
" forEEXIST
, otherwise "rmdir:
strerror(errno):
directorynot removed
" - "
rmdir: Can not remove . or ..:
directorynot removed
" - "
rmdir: Can not remove current directory:
directorynot removed
"
-s
silencing this.
IEEE Std 1003.2-1992
(“POSIX.2”) codifies -p
in this
behavioural shape, but strips the messages (and, hence,
-s
).