man-pages/man1p/rmdir.1p

178 lines
4.9 KiB
Groff

.\" Copyright (c) 2001-2003 The Open Group, All Rights Reserved
.TH "RMDIR" 1P 2003 "IEEE/The Open Group" "POSIX Programmer's Manual"
.\" rmdir
.SH NAME
rmdir \- remove directories
.SH SYNOPSIS
.LP
\fBrmdir\fP \fB[\fP\fB-p\fP\fB]\fP \fIdir\fP\fB...\fP
.SH DESCRIPTION
.LP
The \fIrmdir\fP utility shall remove the directory entry specified
by each \fIdir\fP operand.
.LP
For each \fIdir\fP operand, the \fIrmdir\fP utility shall perform
actions equivalent to the \fIrmdir\fP() function called with the \fIdir\fP
operand as its only argument.
.LP
Directories shall be processed in the order specified. If a directory
and a subdirectory of that directory are specified in a
single invocation of the \fIrmdir\fP utility, the application shall
specify the subdirectory before the parent directory so that
the parent directory will be empty when the \fIrmdir\fP utility tries
to remove it.
.SH OPTIONS
.LP
The \fIrmdir\fP utility shall conform to the Base Definitions volume
of IEEE\ Std\ 1003.1-2001, Section 12.2, Utility Syntax Guidelines.
.LP
The following option shall be supported:
.TP 7
\fB-p\fP
Remove all directories in a pathname. For each \fIdir\fP operand:
.RS
.IP " 1." 4
The directory entry it names shall be removed.
.LP
.IP " 2." 4
If the \fIdir\fP operand includes more than one pathname component,
effects equivalent to the following command shall
occur:
.sp
.RS
.nf
\fBrmdir -p $(dirname\fP \fIdir\fP\fB)
\fP
.fi
.RE
.LP
.RE
.sp
.SH OPERANDS
.LP
The following operand shall be supported:
.TP 7
\fIdir\fP
A pathname of an empty directory to be removed.
.sp
.SH STDIN
.LP
Not used.
.SH INPUT FILES
.LP
None.
.SH ENVIRONMENT VARIABLES
.LP
The following environment variables shall affect the execution of
\fIrmdir\fP:
.TP 7
\fILANG\fP
Provide a default value for the internationalization variables that
are unset or null. (See the Base Definitions volume of
IEEE\ Std\ 1003.1-2001, Section 8.2, Internationalization Variables
for
the precedence of internationalization variables used to determine
the values of locale categories.)
.TP 7
\fILC_ALL\fP
If set to a non-empty string value, override the values of all the
other internationalization variables.
.TP 7
\fILC_CTYPE\fP
Determine the locale for the interpretation of sequences of bytes
of text data as characters (for example, single-byte as
opposed to multi-byte characters in arguments).
.TP 7
\fILC_MESSAGES\fP
Determine the locale that should be used to affect the format and
contents of diagnostic messages written to standard
error.
.TP 7
\fINLSPATH\fP
Determine the location of message catalogs for the processing of \fILC_MESSAGES
\&.\fP
.sp
.SH ASYNCHRONOUS EVENTS
.LP
Default.
.SH STDOUT
.LP
Not used.
.SH STDERR
.LP
The standard error shall be used only for diagnostic messages.
.SH OUTPUT FILES
.LP
None.
.SH EXTENDED DESCRIPTION
.LP
None.
.SH EXIT STATUS
.LP
The following exit values shall be returned:
.TP 7
\ 0
Each directory entry specified by a \fIdir\fP operand was removed
successfully.
.TP 7
>0
An error occurred.
.sp
.SH CONSEQUENCES OF ERRORS
.LP
Default.
.LP
\fIThe following sections are informative.\fP
.SH APPLICATION USAGE
.LP
The definition of an empty directory is one that contains, at most,
directory entries for dot and dot-dot.
.SH EXAMPLES
.LP
If a directory \fBa\fP in the current directory is empty except it
contains a directory \fBb\fP and \fBa/b\fP is empty except
it contains a directory \fBc\fP:
.sp
.RS
.nf
\fBrmdir -p a/b/c
\fP
.fi
.RE
.LP
removes all three directories.
.SH RATIONALE
.LP
On historical System V systems, the \fB-p\fP option also caused a
message to be written to the standard output. The message
indicated whether the whole path was removed or whether part of the
path remained for some reason. The STDERR section requires this
diagnostic when the entire path specified by a \fIdir\fP operand is
not removed, but does not allow the status message reporting
success to be written as a diagnostic.
.LP
The \fIrmdir\fP utility on System V also included a \fB-s\fP option
that suppressed the informational message output by the
\fB-p\fP option. This option has been omitted because the informational
message is not specified by this volume of
IEEE\ Std\ 1003.1-2001.
.SH FUTURE DIRECTIONS
.LP
None.
.SH SEE ALSO
.LP
\fIrm\fP , the System Interfaces volume of IEEE\ Std\ 1003.1-2001,
\fIremove\fP(), \fIrmdir\fP(), \fIunlink\fP()
.SH COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form
from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
-- Portable Operating System Interface (POSIX), The Open Group Base
Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
Electrical and Electronics Engineers, Inc and The Open Group. In the
event of any discrepancy between this version and the original IEEE and
The Open Group Standard, the original IEEE and The Open Group Standard
is the referee document. The original Standard can be obtained online at
http://www.opengroup.org/unix/online.html .