1RMDIR(1P) POSIX Programmer's Manual RMDIR(1P)
2
3
4
6 This manual page is part of the POSIX Programmer's Manual. The Linux
7 implementation of this interface may differ (consult the corresponding
8 Linux manual page for details of Linux behavior), or the interface may
9 not be implemented on Linux.
10
12 rmdir - remove directories
13
15 rmdir [-p] dir...
16
18 The rmdir utility shall remove the directory entry specified by each
19 dir operand.
20
21 For each dir operand, the rmdir utility shall perform actions equiva‐
22 lent to the rmdir() function called with the dir operand as its only
23 argument.
24
25 Directories shall be processed in the order specified. If a directory
26 and a subdirectory of that directory are specified in a single invoca‐
27 tion of the rmdir utility, the application shall specify the subdirec‐
28 tory before the parent directory so that the parent directory will be
29 empty when the rmdir utility tries to remove it.
30
32 The rmdir utility shall conform to the Base Definitions volume of
33 IEEE Std 1003.1-2001, Section 12.2, Utility Syntax Guidelines.
34
35 The following option shall be supported:
36
37 -p Remove all directories in a pathname. For each dir operand:
38
39 1. The directory entry it names shall be removed.
40
41 2. If the dir operand includes more than one pathname compo‐
42 nent, effects equivalent to the following command shall
43 occur:
44
45
46 rmdir -p $(dirname dir)
47
49 The following operand shall be supported:
50
51 dir A pathname of an empty directory to be removed.
52
53
55 Not used.
56
58 None.
59
61 The following environment variables shall affect the execution of
62 rmdir:
63
64 LANG Provide a default value for the internationalization variables
65 that are unset or null. (See the Base Definitions volume of
66 IEEE Std 1003.1-2001, Section 8.2, Internationalization Vari‐
67 ables for the precedence of internationalization variables used
68 to determine the values of locale categories.)
69
70 LC_ALL If set to a non-empty string value, override the values of all
71 the other internationalization variables.
72
73 LC_CTYPE
74 Determine the locale for the interpretation of sequences of
75 bytes of text data as characters (for example, single-byte as
76 opposed to multi-byte characters in arguments).
77
78 LC_MESSAGES
79 Determine the locale that should be used to affect the format
80 and contents of diagnostic messages written to standard error.
81
82 NLSPATH
83 Determine the location of message catalogs for the processing of
84 LC_MESSAGES .
85
86
88 Default.
89
91 Not used.
92
94 The standard error shall be used only for diagnostic messages.
95
97 None.
98
100 None.
101
103 The following exit values shall be returned:
104
105 0 Each directory entry specified by a dir operand was removed suc‐
106 cessfully.
107
108 >0 An error occurred.
109
110
112 Default.
113
114 The following sections are informative.
115
117 The definition of an empty directory is one that contains, at most,
118 directory entries for dot and dot-dot.
119
121 If a directory a in the current directory is empty except it contains a
122 directory b and a/b is empty except it contains a directory c:
123
124
125 rmdir -p a/b/c
126
127 removes all three directories.
128
130 On historical System V systems, the -p option also caused a message to
131 be written to the standard output. The message indicated whether the
132 whole path was removed or whether part of the path remained for some
133 reason. The STDERR section requires this diagnostic when the entire
134 path specified by a dir operand is not removed, but does not allow the
135 status message reporting success to be written as a diagnostic.
136
137 The rmdir utility on System V also included a -s option that suppressed
138 the informational message output by the -p option. This option has been
139 omitted because the informational message is not specified by this vol‐
140 ume of IEEE Std 1003.1-2001.
141
143 None.
144
146 rm, the System Interfaces volume of IEEE Std 1003.1-2001, remove(),
147 rmdir(), unlink()
148
150 Portions of this text are reprinted and reproduced in electronic form
151 from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
152 -- Portable Operating System Interface (POSIX), The Open Group Base
153 Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
154 Electrical and Electronics Engineers, Inc and The Open Group. In the
155 event of any discrepancy between this version and the original IEEE and
156 The Open Group Standard, the original IEEE and The Open Group Standard
157 is the referee document. The original Standard can be obtained online
158 at http://www.opengroup.org/unix/online.html .
159
160
161
162IEEE/The Open Group 2003 RMDIR(1P)