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 POSIX.1‐2017, 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
54 Not used.
55
57 None.
58
60 The following environment variables shall affect the execution of
61 rmdir:
62
63 LANG Provide a default value for the internationalization vari‐
64 ables that are unset or null. (See the Base Definitions vol‐
65 ume of POSIX.1‐2017, Section 8.2, Internationalization Vari‐
66 ables for the precedence of internationalization variables
67 used to determine the values of locale categories.)
68
69 LC_ALL If set to a non-empty string value, override the values of
70 all the other internationalization variables.
71
72 LC_CTYPE Determine the locale for the interpretation of sequences of
73 bytes of text data as characters (for example, single-byte as
74 opposed to multi-byte characters in arguments).
75
76 LC_MESSAGES
77 Determine the locale that should be used to affect the format
78 and contents of diagnostic messages written to standard
79 error.
80
81 NLSPATH Determine the location of message catalogs for the processing
82 of LC_MESSAGES.
83
85 Default.
86
88 Not used.
89
91 The standard error shall be used only for diagnostic messages.
92
94 None.
95
97 None.
98
100 The following exit values shall be returned:
101
102 0 Each directory entry specified by a dir operand was removed suc‐
103 cessfully.
104
105 >0 An error occurred.
106
108 Default.
109
110 The following sections are informative.
111
113 The definition of an empty directory is one that contains, at most,
114 directory entries for dot and dot-dot.
115
117 If a directory a in the current directory is empty except it contains a
118 directory b and a/b is empty except it contains a directory c:
119
120
121 rmdir -p a/b/c
122
123 removes all three directories.
124
126 On historical System V systems, the -p option also caused a message to
127 be written to the standard output. The message indicated whether the
128 whole path was removed or whether part of the path remained for some
129 reason. The STDERR section requires this diagnostic when the entire
130 path specified by a dir operand is not removed, but does not allow the
131 status message reporting success to be written as a diagnostic.
132
133 The rmdir utility on System V also included a -s option that suppressed
134 the informational message output by the -p option. This option has been
135 omitted because the informational message is not specified by this vol‐
136 ume of POSIX.1‐2017.
137
139 None.
140
142 rm
143
144 The Base Definitions volume of POSIX.1‐2017, Chapter 8, Environment
145 Variables, Section 12.2, Utility Syntax Guidelines
146
147 The System Interfaces volume of POSIX.1‐2017, remove(), rmdir(),
148 unlink()
149
151 Portions of this text are reprinted and reproduced in electronic form
152 from IEEE Std 1003.1-2017, Standard for Information Technology -- Por‐
153 table Operating System Interface (POSIX), The Open Group Base Specifi‐
154 cations Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of
155 Electrical and Electronics Engineers, Inc and The Open Group. In the
156 event of any discrepancy between this version and the original IEEE and
157 The Open Group Standard, the original IEEE and The Open Group Standard
158 is the referee document. The original Standard can be obtained online
159 at http://www.opengroup.org/unix/online.html .
160
161 Any typographical or formatting errors that appear in this page are
162 most likely to have been introduced during the conversion of the source
163 files to man page format. To report such errors, see https://www.ker‐
164 nel.org/doc/man-pages/reporting_bugs.html .
165
166
167
168IEEE/The Open Group 2017 RMDIR(1P)