1 | <html>
|
---|
2 |
|
---|
3 | <head>
|
---|
4 | <meta http-equiv="Content-Language" content="en-us">
|
---|
5 | <title>Chown Task</title>
|
---|
6 | <link rel="stylesheet" type="text/css" href="../stylesheets/antmanual.css">
|
---|
7 | </head>
|
---|
8 |
|
---|
9 | <body>
|
---|
10 |
|
---|
11 | <h2><a name="Chown">Chown</a></h2>
|
---|
12 | <p><em>Since Ant 1.6.</em></p>
|
---|
13 | <h3>Description</h3>
|
---|
14 |
|
---|
15 | <p>Changes the owner of a file or all files inside specified
|
---|
16 | directories. Right now it has effect only under Unix. The owner
|
---|
17 | attribute is equivalent to the corresponding argument for the chown
|
---|
18 | command.</p>
|
---|
19 |
|
---|
20 | <p><a href="../CoreTypes/fileset.html">FileSet</a>s,
|
---|
21 | <a href="../CoreTypes/dirset.html">DirSet</a>s or <a
|
---|
22 | href="../CoreTypes/filelist.html">FileList</a>s can be specified using
|
---|
23 | nested <code><fileset></code>, <code><dirset></code> and
|
---|
24 | <code><filelist></code> elements.</p>
|
---|
25 |
|
---|
26 |
|
---|
27 | <p>By default this task will use a single invocation of the underlying
|
---|
28 | chown command. If you are working on a large number of files this may
|
---|
29 | result in a command line that is too long for your operating system.
|
---|
30 | If you encounter such problems, you should set the maxparallel
|
---|
31 | attribute of this task to a non-zero value. The number to use highly
|
---|
32 | depends on the length of your file names (the depth of your directory
|
---|
33 | tree) and your operating system, so you'll have to experiment a
|
---|
34 | little. POSIX recommends command line length limits of at least 4096
|
---|
35 | characters, this may give you an approximation for the number you
|
---|
36 | could use as initial value for these experiments.</p>
|
---|
37 |
|
---|
38 | <h3>Parameters</h3>
|
---|
39 | <table border="1" cellpadding="2" cellspacing="0">
|
---|
40 | <tr>
|
---|
41 | <td valign="top"><b>Attribute</b></td>
|
---|
42 | <td valign="top"><b>Description</b></td>
|
---|
43 | <td align="center" valign="top"><b>Required</b></td>
|
---|
44 | </tr>
|
---|
45 | <tr>
|
---|
46 | <td valign="top">file</td>
|
---|
47 | <td valign="top">the file or directory of which the owner must be
|
---|
48 | changed.</td>
|
---|
49 | <td valign="top" valign="middle">Yes or nested
|
---|
50 | <code><fileset/list></code> elements.</td>
|
---|
51 | </tr>
|
---|
52 | <tr>
|
---|
53 | <td valign="top">owner</td>
|
---|
54 | <td valign="top">the new owner.</td>
|
---|
55 | <td valign="top" align="center">Yes</td>
|
---|
56 | </tr>
|
---|
57 | <tr>
|
---|
58 | <td valign="top">parallel</td>
|
---|
59 | <td valign="top">process all specified files using a single
|
---|
60 | <code>chown</code> command. Defaults to true.</td>
|
---|
61 | <td valign="top" align="center">No</td>
|
---|
62 | </tr>
|
---|
63 | <tr>
|
---|
64 | <td valign="top">type</td>
|
---|
65 | <td valign="top">One of <i>file</i>, <i>dir</i> or
|
---|
66 | <i>both</i>. If set to <i>file</i>, only the owner of
|
---|
67 | plain files are going to be changed. If set to <i>dir</i>, only
|
---|
68 | the directories are considered.<br>
|
---|
69 | <strong>Note:</strong> The type attribute does not apply to
|
---|
70 | nested <i>dirset</i>s - <i>dirset</i>s always implicitly
|
---|
71 | assume type to be <i>dir</i>.</td>
|
---|
72 | <td align="center" valign="top">No, default is <i>file</i></td>
|
---|
73 | </tr>
|
---|
74 | <tr>
|
---|
75 | <td valign="top">maxparallel</td>
|
---|
76 | <td valign="top">Limit the amount of parallelism by passing at
|
---|
77 | most this many sourcefiles at once. Set it to <= 0 for
|
---|
78 | unlimited. Defaults to unlimited.</td>
|
---|
79 | <td align="center" valign="top">No</td>
|
---|
80 |
|
---|
81 | </tr>
|
---|
82 | <tr>
|
---|
83 | <td valign="top">verbose</td>
|
---|
84 | <td valign="top">Whether to print a summary after execution or not.
|
---|
85 | Defaults to <code>false</code>.</td>
|
---|
86 | <td align="center" valign="top">No</td>
|
---|
87 | </tr>
|
---|
88 |
|
---|
89 | </table>
|
---|
90 | <h3>Examples</h3>
|
---|
91 | <blockquote>
|
---|
92 | <p><code><chown file="${dist}/start.sh" owner="coderjoe"/></code></p>
|
---|
93 | </blockquote>
|
---|
94 | <p>makes the "start.sh" file belong to coderjoe on a
|
---|
95 | UNIX system.</p>
|
---|
96 | <blockquote>
|
---|
97 | <pre>
|
---|
98 | <chown owner="coderjoe">
|
---|
99 | <fileset dir="${dist}/bin" includes="**/*.sh"/>
|
---|
100 | </chown>
|
---|
101 | </pre>
|
---|
102 | </blockquote>
|
---|
103 | <p>makes all ".sh" files below <code>${dist}/bin</code>
|
---|
104 | belong to coderjoe on a UNIX system.</p>
|
---|
105 | <blockquote>
|
---|
106 | <pre>
|
---|
107 | <chown owner="coderjoe">
|
---|
108 | <fileset dir="shared/sources1">
|
---|
109 | <exclude name="**/trial/**"/>
|
---|
110 | </fileset>
|
---|
111 | <fileset refid="other.shared.sources"/>
|
---|
112 | </chown>
|
---|
113 | </pre>
|
---|
114 | </blockquote>
|
---|
115 | <p>makes all files below <code>shared/sources1</code> (except those
|
---|
116 | below any directory named trial) belong to coderjoe on a UNIX
|
---|
117 | system. In addition all files belonging to a FileSet
|
---|
118 | with <code>id</code> <code>other.shared.sources</code> get the same
|
---|
119 | owner.</p>
|
---|
120 |
|
---|
121 | <blockquote>
|
---|
122 | <pre>
|
---|
123 | <chown owner="webadmin" type="file">
|
---|
124 | <fileset dir="/web">
|
---|
125 | <include name="**/*.cgi"/>
|
---|
126 | <include name="**/*.old"/>
|
---|
127 | </fileset>
|
---|
128 | <dirset dir="/web">
|
---|
129 | <include name="**/private_*"/>
|
---|
130 | </dirset>
|
---|
131 | </chmod>
|
---|
132 | </pre>
|
---|
133 | </blockquote>
|
---|
134 |
|
---|
135 | <p>makes cgi scripts, files with a <code>.old</code> extension or
|
---|
136 | directories beginning with <code>private_</code> belong to the user named
|
---|
137 | webadmin. A directory ending in <code>.old</code> or a file beginning with
|
---|
138 | <code>private_</code> would remain unaffected.</p>
|
---|
139 |
|
---|
140 | <hr>
|
---|
141 | <p align="center">Copyright © 2002-2004 The Apache Software
|
---|
142 | Foundation. All rights Reserved.</p>
|
---|
143 |
|
---|
144 | </body>
|
---|
145 | </html>
|
---|
146 |
|
---|