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

PROLOG

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
11

NAME

13       rmdir — remove directories
14

SYNOPSIS

16       rmdir [−p] dir...
17

DESCRIPTION

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

OPTIONS

33       The  rmdir  utility  shall  conform  to  the Base Definitions volume of
34       POSIX.1‐2008, Section 12.2, Utility Syntax Guidelines.
35
36       The following option shall be supported:
37
38       −p        Remove all directories in a pathname. For each dir operand:
39
40                  1. The directory entry it names shall be removed.
41
42                  2. If the dir operand includes more than one pathname compo‐
43                     nent,  effects  equivalent to the following command shall
44                     occur:
45
46                         rmdir −p $(dirname dir)
47

OPERANDS

49       The following operand shall be supported:
50
51       dir       A pathname of an empty directory to be removed.
52

STDIN

54       Not used.
55

INPUT FILES

57       None.
58

ENVIRONMENT VARIABLES

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‐2008, 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

ASYNCHRONOUS EVENTS

85       Default.
86

STDOUT

88       Not used.
89

STDERR

91       The standard error shall be used only for diagnostic messages.
92

OUTPUT FILES

94       None.
95

EXTENDED DESCRIPTION

97       None.
98

EXIT STATUS

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

CONSEQUENCES OF ERRORS

108       Default.
109
110       The following sections are informative.
111

APPLICATION USAGE

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

EXAMPLES

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           rmdir −p a/b/c
121
122       removes all three directories.
123

RATIONALE

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

FUTURE DIRECTIONS

138       None.
139

SEE ALSO

141       rm
142
143       The Base Definitions volume of  POSIX.1‐2008,  Chapter  8,  Environment
144       Variables, Section 12.2, Utility Syntax Guidelines
145
146       The  System  Interfaces  volume  of  POSIX.1‐2008,  remove(),  rmdir(),
147       unlink()
148
150       Portions of this text are reprinted and reproduced in  electronic  form
151       from IEEE Std 1003.1, 2013 Edition, Standard for Information Technology
152       -- Portable Operating System Interface (POSIX),  The  Open  Group  Base
153       Specifications Issue 7, Copyright (C) 2013 by the Institute of Electri‐
154       cal and Electronics Engineers,  Inc  and  The  Open  Group.   (This  is
155       POSIX.1-2008  with  the  2013  Technical Corrigendum 1 applied.) 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.unix.org/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                  2013                            RMDIR(1P)
Impressum