1RMDIR(P)                   POSIX Programmer's Manual                  RMDIR(P)
2
3
4

NAME

6       rmdir - remove directories
7

SYNOPSIS

9       rmdir [-p] dir...
10

DESCRIPTION

12       The  rmdir  utility  shall remove the directory entry specified by each
13       dir operand.
14
15       For each dir operand, the rmdir utility shall perform  actions  equiva‐
16       lent  to  the  rmdir() function called with the dir operand as its only
17       argument.
18
19       Directories shall be processed in the order specified. If  a  directory
20       and  a subdirectory of that directory are specified in a single invoca‐
21       tion of the rmdir utility, the application shall specify the  subdirec‐
22       tory  before  the parent directory so that the parent directory will be
23       empty when the rmdir utility tries to remove it.
24

OPTIONS

26       The rmdir utility shall conform  to  the  Base  Definitions  volume  of
27       IEEE Std 1003.1-2001, Section 12.2, Utility Syntax Guidelines.
28
29       The following option shall be supported:
30
31       -p     Remove all directories in a pathname. For each dir operand:
32
33               1. The directory entry it names shall be removed.
34
35               2. If  the  dir  operand includes more than one pathname compo‐
36                  nent, effects equivalent  to  the  following  command  shall
37                  occur:
38
39
40                  rmdir -p $(dirname dir)
41

OPERANDS

43       The following operand shall be supported:
44
45       dir    A pathname of an empty directory to be removed.
46
47

STDIN

49       Not used.
50

INPUT FILES

52       None.
53

ENVIRONMENT VARIABLES

55       The  following  environment  variables  shall  affect  the execution of
56       rmdir:
57
58       LANG   Provide a default value for the  internationalization  variables
59              that  are  unset  or  null.  (See the Base Definitions volume of
60              IEEE Std 1003.1-2001, Section  8.2,  Internationalization  Vari‐
61              ables  for the precedence of internationalization variables used
62              to determine the values of locale categories.)
63
64       LC_ALL If set to a non-empty string value, override the values  of  all
65              the other internationalization variables.
66
67       LC_CTYPE
68              Determine  the  locale  for  the  interpretation of sequences of
69              bytes of text data as characters (for  example,  single-byte  as
70              opposed to multi-byte characters in arguments).
71
72       LC_MESSAGES
73              Determine  the  locale  that should be used to affect the format
74              and contents of diagnostic messages written to standard error.
75
76       NLSPATH
77              Determine the location of message catalogs for the processing of
78              LC_MESSAGES .
79
80

ASYNCHRONOUS EVENTS

82       Default.
83

STDOUT

85       Not used.
86

STDERR

88       The standard error shall be used only for diagnostic messages.
89

OUTPUT FILES

91       None.
92

EXTENDED DESCRIPTION

94       None.
95

EXIT STATUS

97       The following exit values shall be returned:
98
99        0     Each directory entry specified by a dir operand was removed suc‐
100              cessfully.
101
102       >0     An error occurred.
103
104

CONSEQUENCES OF ERRORS

106       Default.
107
108       The following sections are informative.
109

APPLICATION USAGE

111       The definition of an empty directory is one  that  contains,  at  most,
112       directory entries for dot and dot-dot.
113

EXAMPLES

115       If a directory a in the current directory is empty except it contains a
116       directory b and a/b is empty except it contains a directory c:
117
118
119              rmdir -p a/b/c
120
121       removes all three directories.
122

RATIONALE

124       On historical System V systems, the -p option also caused a message  to
125       be  written  to  the standard output. The message indicated whether the
126       whole path was removed or whether part of the path  remained  for  some
127       reason.  The  STDERR  section  requires this diagnostic when the entire
128       path specified by a dir operand is not removed, but does not allow  the
129       status message reporting success to be written as a diagnostic.
130
131       The rmdir utility on System V also included a -s option that suppressed
132       the informational message output by the -p option. This option has been
133       omitted because the informational message is not specified by this vol‐
134       ume of IEEE Std 1003.1-2001.
135

FUTURE DIRECTIONS

137       None.
138

SEE ALSO

140       rm , the System Interfaces volume  of  IEEE Std 1003.1-2001,  remove(),
141       rmdir(), unlink()
142
144       Portions  of  this text are reprinted and reproduced in electronic form
145       from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
146       --  Portable  Operating  System  Interface (POSIX), The Open Group Base
147       Specifications Issue 6, Copyright (C) 2001-2003  by  the  Institute  of
148       Electrical  and  Electronics  Engineers, Inc and The Open Group. In the
149       event of any discrepancy between this version and the original IEEE and
150       The  Open Group Standard, the original IEEE and The Open Group Standard
151       is the referee document. The original Standard can be  obtained  online
152       at http://www.opengroup.org/unix/online.html .
153
154
155
156IEEE/The Open Group                  2003                             RMDIR(P)
Impressum