source: other-projects/trunk/gs3-release-maker/apache-ant-1.6.5/docs/manual/OptionalTasks/chown.html@ 14627

Last change on this file since 14627 was 14627, checked in by oranfry, 17 years ago

initial import of the gs3-release-maker

File size: 5.0 KB
Line 
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
16directories. Right now it has effect only under Unix. The owner
17attribute is equivalent to the corresponding argument for the chown
18command.</p>
19
20<p><a href="../CoreTypes/fileset.html">FileSet</a>s,
21<a href="../CoreTypes/dirset.html">DirSet</a>s or <a
22href="../CoreTypes/filelist.html">FileList</a>s can be specified using
23nested <code>&lt;fileset&gt;</code>, <code>&lt;dirset&gt;</code> and
24<code>&lt;filelist&gt;</code> elements.</p>
25
26
27<p>By default this task will use a single invocation of the underlying
28chown command. If you are working on a large number of files this may
29result in a command line that is too long for your operating system.
30If you encounter such problems, you should set the maxparallel
31attribute of this task to a non-zero value. The number to use highly
32depends on the length of your file names (the depth of your directory
33tree) and your operating system, so you'll have to experiment a
34little. POSIX recommends command line length limits of at least 4096
35characters, this may give you an approximation for the number you
36could 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>&lt;fileset/list&gt;</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 &lt;= 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>&lt;chown file=&quot;${dist}/start.sh&quot; owner=&quot;coderjoe&quot;/&gt;</code></p>
93</blockquote>
94<p>makes the &quot;start.sh&quot; file belong to coderjoe on a
95UNIX system.</p>
96<blockquote>
97<pre>
98 &lt;chown owner=&quot;coderjoe&quot;&gt;
99 &lt;fileset dir=&quot;${dist}/bin&quot; includes=&quot;**/*.sh&quot;/&gt;
100 &lt;/chown&gt;
101</pre>
102</blockquote>
103<p>makes all &quot;.sh&quot; files below <code>${dist}/bin</code>
104belong to coderjoe on a UNIX system.</p>
105<blockquote>
106<pre>
107&lt;chown owner=&quot;coderjoe&quot;&gt;
108 &lt;fileset dir=&quot;shared/sources1&quot;&gt;
109 &lt;exclude name=&quot;**/trial/**&quot;/&gt;
110 &lt;/fileset&gt;
111 &lt;fileset refid=&quot;other.shared.sources&quot;/&gt;
112&lt;/chown&gt;
113</pre>
114</blockquote>
115<p>makes all files below <code>shared/sources1</code> (except those
116below any directory named trial) belong to coderjoe on a UNIX
117system. In addition all files belonging to a FileSet
118with <code>id</code> <code>other.shared.sources</code> get the same
119owner.</p>
120
121<blockquote>
122<pre>
123&lt;chown owner=&quot;webadmin&quot; type=&quot;file&quot;&gt;
124 &lt;fileset dir=&quot;/web&quot;&gt;
125 &lt;include name=&quot;**/*.cgi&quot;/&gt;
126 &lt;include name=&quot;**/*.old&quot;/&gt;
127 &lt;/fileset&gt;
128 &lt;dirset dir=&quot;/web&quot;&gt;
129 &lt;include name=&quot;**/private_*&quot;/&gt;
130 &lt;/dirset&gt;
131&lt;/chmod&gt;
132</pre>
133</blockquote>
134
135<p>makes cgi scripts, files with a <code>.old</code> extension or
136directories beginning with <code>private_</code> belong to the user named
137webadmin. 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 &copy; 2002-2004 The Apache Software
142Foundation. All rights Reserved.</p>
143
144</body>
145</html>
146
Note: See TracBrowser for help on using the repository browser.