posix_opengroup_mkdir.html - webdump_tests - Testfiles for webdump
(HTM) git clone git://git.codemadness.org/webdump_tests
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
---
posix_opengroup_mkdir.html (12992B)
---
1 <!-- Copyright 2001-2013 IEEE and The Open Group, All Rights Reserved -->
2 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
3 <html>
4 <head>
5 <meta name="generator" content="HTML Tidy, see www.w3.org">
6 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
7 <link type="text/css" rel="stylesheet" href="style.css"><!-- Generated by The Open Group's rhtm tool v1.2.4 -->
8 <!-- Copyright (c) 2001-2013 The Open Group, All Rights Reserved -->
9 <title>mkdir</title>
10 <!-- Global site tag (gtag.js) - Google Analytics -->
11 <script async src="https://www.googletagmanager.com/gtag/js?id=G-NNDC9YRG6R"></script>
12 <script>
13 window.dataLayer = window.dataLayer || [];
14 function gtag(){dataLayer.push(arguments);}
15 gtag('js', new Date());
16
17 gtag('config', 'G-NNDC9YRG6R');
18 </script>
19
20 </head>
21 <body bgcolor="white">
22 <div class="NAVHEADER">
23 <table summary="Header navigation table" class="nav" width="100%" border="0" cellpadding="0" cellspacing="0">
24 <tr class="nav">
25 <td class="nav" width="15%" align="left" valign="bottom"><a href="../utilities/mesg.html" accesskey="P"><<< Previous</a></td>
26 <td class="nav" width="70%" align="center" valign="bottom"><a href="contents.html">Home</a></td>
27 <td class="nav" width="15%" align="right" valign="bottom"><a href="../utilities/mkfifo.html" accesskey="N">Next >>></a></td>
28 </tr>
29 </table>
30
31 <hr align="LEFT" width="100%">
32 </div>
33
34 <script type="text/javascript" language="JavaScript" src="../jscript/codes.js">
35 </script>
36
37 <basefont size="3">
38
39 <center><font size="2">The Open Group Base Specifications Issue 7, 2018 edition<br>
40 IEEE Std 1003.1-2017 (Revision of IEEE Std 1003.1-2008)<br>
41 Copyright © 2001-2018 IEEE and The Open Group</font></center>
42
43 <hr size="2" noshade>
44 <a name="top"></a> <a name="mkdir"></a> <a name="tag_20_79"></a><!-- mkdir -->
45
46
47 <h4 class="mansect"><a name="tag_20_79_01"></a>NAME</h4>
48
49 <blockquote>mkdir - make directories</blockquote>
50
51 <h4 class="mansect"><a name="tag_20_79_02"></a>SYNOPSIS</h4>
52
53 <blockquote class="synopsis">
54 <p><code><tt>mkdir</tt> <b>[</b><tt>-p</tt><b>] [</b><tt>-m</tt> <i>mode</i><b>]</b> <i>dir</i><tt>...</tt></code></p>
55 </blockquote>
56
57 <h4 class="mansect"><a name="tag_20_79_03"></a>DESCRIPTION</h4>
58
59 <blockquote>
60 <p>The <i>mkdir</i> utility shall create the directories specified by the operands, in the order specified.</p>
61
62 <p>For each <i>dir</i> operand, the <i>mkdir</i> utility shall perform actions equivalent to the <a href=
63 "../functions/mkdir.html"><i>mkdir</i>()</a> function defined in the System Interfaces volume of POSIX.1-2017, called with the
64 following arguments:</p>
65
66 <ol>
67 <li>
68 <p>The <i>dir</i> operand is used as the <i>path</i> argument.</p>
69 </li>
70
71 <li>
72 <p>The value of the bitwise-inclusive OR of S_IRWXU, S_IRWXG, and S_IRWXO is used as the <i>mode</i> argument. (If the <b>-m</b>
73 option is specified, the value of the <a href="../functions/mkdir.html"><i>mkdir</i>()</a> <i>mode</i> argument is unspecified, but
74 the directory shall at no time have permissions less restrictive than the <b>-m</b> <i>mode</i> option-argument.)</p>
75 </li>
76 </ol>
77 </blockquote>
78
79 <h4 class="mansect"><a name="tag_20_79_04"></a>OPTIONS</h4>
80
81 <blockquote>
82 <p>The <i>mkdir</i> utility shall conform to XBD <a href="../basedefs/V1_chap12.html#tag_12_02"><i>Utility Syntax
83 Guidelines</i></a>.</p>
84
85 <p>The following options shall be supported:</p>
86
87 <dl compact>
88 <dt><b>-m </b> <i>mode</i></dt>
89
90 <dd>Set the file permission bits of the newly-created directory to the specified <i>mode</i> value. The <i>mode</i> option-argument
91 shall be the same as the <i>mode</i> operand defined for the <a href="../utilities/chmod.html"><i>chmod</i></a> utility. In the
92 <i>symbolic_mode</i> strings, the <i>op</i> characters <tt>'+'</tt> and <tt>'-'</tt> shall be interpreted relative to an assumed
93 initial mode of <i>a</i>= <i>rwx</i>; <tt>'+'</tt> shall add permissions to the default mode, <tt>'-'</tt> shall delete permissions
94 from the default mode.</dd>
95
96 <dt><b>-p</b></dt>
97
98 <dd>Create any missing intermediate pathname components.
99
100 <p>For each <i>dir</i> operand that does not name an existing directory, before performing the actions described in the DESCRIPTION
101 above, the <i>mkdir</i> utility shall create any pathname components of the path prefix of <i>dir</i> that do not name an existing
102 directory by performing actions equivalent to first calling the <a href="../functions/mkdir.html"><i>mkdir</i>()</a> function with
103 the following arguments:</p>
104
105 <ol>
106 <li>
107 <p>A pathname naming the missing pathname component, ending with a trailing <slash> character, as the <i>path</i>
108 argument</p>
109 </li>
110
111 <li>
112 <p>The value zero as the <i>mode</i> argument</p>
113 </li>
114 </ol>
115
116 <p>and then calling the <a href="../functions/chmod.html"><i>chmod</i>()</a> function with the following arguments:</p>
117
118 <ol>
119 <li>
120 <p>The same <i>path</i> argument as in the <a href="../functions/mkdir.html"><i>mkdir</i>()</a> call</p>
121 </li>
122
123 <li>
124 <p>The value <tt>(S_IWUSR|S_IXUSR|~<i>filemask</i>)&0777</tt> as the <i>mode</i> argument, where <i>filemask</i> is the
125 file mode creation mask of the process (see XSH <a href="../functions/umask.html#tag_16_631"><i>umask</i></a>)</p>
126 </li>
127 </ol>
128
129 <p>Each <i>dir</i> operand that names an existing directory shall be ignored without error.</p>
130 </dd>
131 </dl>
132 </blockquote>
133
134 <h4 class="mansect"><a name="tag_20_79_05"></a>OPERANDS</h4>
135
136 <blockquote>
137 <p>The following operand shall be supported:</p>
138
139 <dl compact>
140 <dt><i>dir</i></dt>
141
142 <dd>A pathname of a directory to be created.</dd>
143 </dl>
144 </blockquote>
145
146 <h4 class="mansect"><a name="tag_20_79_06"></a>STDIN</h4>
147
148 <blockquote>
149 <p>Not used.</p>
150 </blockquote>
151
152 <h4 class="mansect"><a name="tag_20_79_07"></a>INPUT FILES</h4>
153
154 <blockquote>
155 <p>None.</p>
156 </blockquote>
157
158 <h4 class="mansect"><a name="tag_20_79_08"></a>ENVIRONMENT VARIABLES</h4>
159
160 <blockquote>
161 <p>The following environment variables shall affect the execution of <i>mkdir</i>:</p>
162
163 <dl compact>
164 <dt><i>LANG</i></dt>
165
166 <dd>Provide a default value for the internationalization variables that are unset or null. (See XBD <a href=
167 "../basedefs/V1_chap08.html#tag_08_02"><i>Internationalization Variables</i></a> for the precedence of internationalization
168 variables used to determine the values of locale categories.)</dd>
169
170 <dt><i>LC_ALL</i></dt>
171
172 <dd>If set to a non-empty string value, override the values of all the other internationalization variables.</dd>
173
174 <dt><i>LC_CTYPE</i></dt>
175
176 <dd>Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte as
177 opposed to multi-byte characters in arguments).</dd>
178
179 <dt><i>LC_MESSAGES</i></dt>
180
181 <dd>
182 Determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error.</dd>
183
184 <dt><i>NLSPATH</i></dt>
185
186 <dd><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
187 Determine the location of message catalogs for the processing of <i>LC_MESSAGES.</i> <img src="../images/opt-end.gif" alt=
188 "[Option End]" border="0"></dd>
189 </dl>
190 </blockquote>
191
192 <h4 class="mansect"><a name="tag_20_79_09"></a>ASYNCHRONOUS EVENTS</h4>
193
194 <blockquote>
195 <p>Default.</p>
196 </blockquote>
197
198 <h4 class="mansect"><a name="tag_20_79_10"></a>STDOUT</h4>
199
200 <blockquote>
201 <p>Not used.</p>
202 </blockquote>
203
204 <h4 class="mansect"><a name="tag_20_79_11"></a>STDERR</h4>
205
206 <blockquote>
207 <p>The standard error shall be used only for diagnostic messages.</p>
208 </blockquote>
209
210 <h4 class="mansect"><a name="tag_20_79_12"></a>OUTPUT FILES</h4>
211
212 <blockquote>
213 <p>None.</p>
214 </blockquote>
215
216 <h4 class="mansect"><a name="tag_20_79_13"></a>EXTENDED DESCRIPTION</h4>
217
218 <blockquote>
219 <p>None.</p>
220 </blockquote>
221
222 <h4 class="mansect"><a name="tag_20_79_14"></a>EXIT STATUS</h4>
223
224 <blockquote>
225 <p>The following exit values shall be returned:</p>
226
227 <dl compact>
228 <dt> 0</dt>
229
230 <dd>All the specified directories were created successfully, or the <b>-p</b> option was specified and all the specified
231 directories either already existed or were created successfully.</dd>
232
233 <dt>>0</dt>
234
235 <dd>An error occurred.</dd>
236 </dl>
237 </blockquote>
238
239 <h4 class="mansect"><a name="tag_20_79_15"></a>CONSEQUENCES OF ERRORS</h4>
240
241 <blockquote>
242 <p>Default.</p>
243 </blockquote>
244
245 <hr>
246 <div class="box"><em>The following sections are informative.</em></div>
247
248 <h4 class="mansect"><a name="tag_20_79_16"></a>APPLICATION USAGE</h4>
249
250 <blockquote>
251 <p>The default file mode for directories is <i>a</i>= <i>rwx</i> (777 on most systems) with selected permissions removed in
252 accordance with the file mode creation mask. For intermediate pathname components created by <i>mkdir</i>, the mode is the default
253 modified by <i>u</i>+ <i>wx</i> so that the subdirectories can always be created regardless of the file mode creation mask; if
254 different ultimate permissions are desired for the intermediate directories, they can be changed afterwards with <a href=
255 "../utilities/chmod.html"><i>chmod</i></a>.</p>
256
257 <p>Note that some of the requested directories may have been created even if an error occurs.</p>
258 </blockquote>
259
260 <h4 class="mansect"><a name="tag_20_79_17"></a>EXAMPLES</h4>
261
262 <blockquote>
263 <p>None.</p>
264 </blockquote>
265
266 <h4 class="mansect"><a name="tag_20_79_18"></a>RATIONALE</h4>
267
268 <blockquote>
269 <p>The System V <b>-m</b> option was included to control the file mode.</p>
270
271 <p>The System V <b>-p</b> option was included to create any needed intermediate directories and to complement the functionality
272 provided by <a href="../utilities/rmdir.html"><i>rmdir</i></a> for removing directories in the path prefix as they become empty.
273 Because no error is produced if any path component already exists, the <b>-p</b> option is also useful to ensure that a particular
274 directory exists.</p>
275
276 <p>The functionality of <i>mkdir</i> is described substantially through a reference to the <a href=
277 "../functions/mkdir.html"><i>mkdir</i>()</a> function in the System Interfaces volume of POSIX.1-2017. For example, by default, the
278 mode of the directory is affected by the file mode creation mask in accordance with the specified behavior of the <a href=
279 "../functions/mkdir.html"><i>mkdir</i>()</a> function. In this way, there is less duplication of effort required for describing
280 details of the directory creation.</p>
281 </blockquote>
282
283 <h4 class="mansect"><a name="tag_20_79_19"></a>FUTURE DIRECTIONS</h4>
284
285 <blockquote>
286 <p>None.</p>
287 </blockquote>
288
289 <h4 class="mansect"><a name="tag_20_79_20"></a>SEE ALSO</h4>
290
291 <blockquote>
292 <p><a href="../utilities/chmod.html#tag_20_17"><i>chmod</i></a>, <a href="../utilities/rm.html#"><i>rm</i></a>, <a href=
293 "../utilities/rmdir.html#tag_20_113"><i>rmdir</i></a>, <a href="../utilities/umask.html#tag_20_138"><i>umask</i></a></p>
294
295 <p>XBD <a href="../basedefs/V1_chap08.html#tag_08"><i>Environment Variables</i></a>, <a href=
296 "../basedefs/V1_chap12.html#tag_12_02"><i>Utility Syntax Guidelines</i></a></p>
297
298 <p>XSH <a href="../functions/mkdir.html#tag_16_325"><i>mkdir</i></a>, <a href=
299 "../functions/umask.html#tag_16_631"><i>umask</i></a></p>
300 </blockquote>
301
302 <h4 class="mansect"><a name="tag_20_79_21"></a>CHANGE HISTORY</h4>
303
304 <blockquote>
305 <p>First released in Issue 2.</p>
306 </blockquote>
307
308 <h4 class="mansect"><a name="tag_20_79_22"></a>Issue 5</h4>
309
310 <blockquote>
311 <p>The FUTURE DIRECTIONS section is added.</p>
312 </blockquote>
313
314 <h4 class="mansect"><a name="tag_20_79_23"></a>Issue 7</h4>
315
316 <blockquote>
317 <p>SD5-XCU-ERN-56 is applied, aligning the <b>-m</b> option with the IEEE P1003.2b draft standard to clarify an ambiguity.</p>
318
319 <p>SD5-XCU-ERN-97 is applied, updating the SYNOPSIS.</p>
320
321 <p>POSIX.1-2008, Technical Corrigendum 1, XCU/TC1-2008/0122 [161] is applied.</p>
322
323 <p>POSIX.1-2008, Technical Corrigendum 2, XCU/TC2-2008/0145 [843] is applied.</p>
324 </blockquote>
325
326 <div class="box"><em>End of informative text.</em></div>
327
328 <hr>
329 <p> </p>
330
331 <a href="#top"><span class="topOfPage">return to top of page</span></a><br>
332 <hr size="2" noshade>
333 <center><font size="2">UNIX ® is a registered Trademark of The Open Group.<br>
334 POSIX ™ is a Trademark of The IEEE.<br>
335 Copyright © 2001-2018 IEEE and The Open Group, All Rights Reserved<br>
336 [ <a href="../mindex.html">Main Index</a> | <a href="../basedefs/contents.html">XBD</a> | <a href=
337 "../functions/contents.html">XSH</a> | <a href="../utilities/contents.html">XCU</a> | <a href="../xrat/contents.html">XRAT</a>
338 ]</font></center>
339
340 <hr size="2" noshade>
341 <div class="NAVHEADER">
342 <table summary="Header navigation table" class="nav" width="100%" border="0" cellpadding="0" cellspacing="0">
343 <tr class="nav">
344 <td class="nav" width="15%" align="left" valign="bottom"><a href="../utilities/mesg.html" accesskey="P"><<< Previous</a></td>
345 <td class="nav" width="70%" align="center" valign="bottom"><a href="contents.html">Home</a></td>
346 <td class="nav" width="15%" align="right" valign="bottom"><a href="../utilities/mkfifo.html" accesskey="N">Next >>></a></td>
347 </tr>
348 </table>
349
350 <hr align="LEFT" width="100%">
351 </div>
352 </body>
353 </html>
354