source: other-projects/trunk/gs3-release-maker/apache-ant-1.6.5/docs/manual/CoreTasks/chmod.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: 6.4 KB
Line 
1<html>
2
3<head>
4<meta http-equiv="Content-Language" content="en-us">
5<title>Chmod Task</title>
6<link rel="stylesheet" type="text/css" href="../stylesheets/antmanual.css">
7</head>
8
9<body>
10
11<h2><a name="chmod">Chmod</a></h2>
12<h3>Description</h3>
13<p>Changes the permissions of a file or all files inside specified
14directories. Right now it has effect only under Unix or NonStop Kernel (Tandem).
15The permissions are also UNIX style, like the argument for the chmod command.</p>
16<p>See the section on <a href="../dirtasks.html#directorybasedtasks">directory based
17tasks</a>, on how the inclusion/exclusion of files works, and how to
18write patterns.</p>
19
20<p>This task holds an implicit <a
21href="../CoreTypes/fileset.html">FileSet</a> and supports all of
22FileSet's attributes and nested elements directly. More sets can be
23specified using nested <code>&lt;fileset&gt;</code> or
24<code>&lt;dirset&gt;</code> (<em>since Ant 1.6</em>) elements. </p>
25
26<p>Starting with Ant 1.6, this task also supports nested <a
27href="../CoreTypes/filelist.html">filelist</a>s.</p>
28
29<p>By default this task will use a single invocation of the underlying
30chmod command. If you are working on a large number of files this may
31result in a command line that is too long for your operating system.
32If you encounter such problems, you should set the maxparallel
33attribute of this task to a non-zero value. The number to use highly
34depends on the length of your file names (the depth of your directory
35tree) and your operating system, so you'll have to experiment a
36little. POSIX recommends command line length limits of at least 4096
37characters, this may give you an approximation for the number you
38could use as initial value for these experiments.</p>
39
40<h3>Parameters</h3>
41<table border="1" cellpadding="2" cellspacing="0">
42 <tr>
43 <td valign="top"><b>Attribute</b></td>
44 <td valign="top"><b>Description</b></td>
45 <td align="center" valign="top"><b>Required</b></td>
46 </tr>
47 <tr>
48 <td valign="top">file</td>
49 <td valign="top">the file or single directory of which the permissions
50 must be changed.</td>
51 <td valign="top" valign="middle" rowspan="2">exactly one of the two or nested <code>&lt;fileset/list&gt;</code> elements.</td>
52 </tr>
53 <tr>
54 <td valign="top">dir</td>
55 <td valign="top">the directory which holds the files whose permissions
56 must be changed.</td>
57 </tr>
58 <tr>
59 <td valign="top">perm</td>
60 <td valign="top">the new permissions.</td>
61 <td valign="top" align="center">Yes</td>
62 </tr>
63 <tr>
64 <td valign="top">includes</td>
65 <td valign="top">comma- or space-separated list of patterns of files that must be
66 included.</td>
67 <td valign="top" align="center">No</td>
68 </tr>
69 <tr>
70 <td valign="top">excludes</td>
71 <td valign="top">comma- or space-separated list of patterns of files that must be
72 excluded. No files (except default excludes) are excluded when omitted.</td>
73 <td valign="top" align="center">No</td>
74 </tr>
75 <tr>
76 <td valign="top">defaultexcludes</td>
77 <td valign="top">indicates whether default excludes should be used or not
78 (&quot;yes&quot;/&quot;no&quot;). Default excludes are used when omitted.</td>
79 <td valign="top" align="center">No</td>
80 </tr>
81 <tr>
82 <td valign="top">parallel</td>
83 <td valign="top">process all specified files using a single
84 <code>chmod</code> command. Defaults to true.</td>
85 <td valign="top" align="center">No</td>
86 </tr>
87 <tr>
88 <td valign="top">type</td>
89 <td valign="top">One of <i>file</i>, <i>dir</i> or
90 <i>both</i>. If set to <i>file</i>, only the permissions of
91 plain files are going to be changed. If set to <i>dir</i>, only
92 the directories are considered.<br>
93 <strong>Note:</strong> The type attribute does not apply to
94 nested <i>dirset</i>s - <i>dirset</i>s always implicitly
95 assume type to be <i>dir</i>.</td>
96 <td align="center" valign="top">No, default is <i>file</i></td>
97 </tr>
98 <tr>
99 <td valign="top">maxparallel</td>
100 <td valign="top">Limit the amount of parallelism by passing at
101 most this many sourcefiles at once. Set it to &lt;= 0 for
102 unlimited. Defaults to unlimited. <em>Since Ant 1.6.</em></td>
103 <td align="center" valign="top">No</td>
104 </tr>
105 <tr>
106 <td valign="top">verbose</td>
107 <td valign="top">Whether to print a summary after execution or not.
108 Defaults to <code>false</code>. <em>Since Ant 1.6.</em></td>
109 <td align="center" valign="top">No</td>
110 </tr>
111</table>
112<h3>Examples</h3>
113 <blockquote><pre>
114&lt;chmod file=&quot;${dist}/start.sh&quot; perm=&quot;ugo+rx&quot;/&gt;
115</pre></blockquote>
116<p>makes the &quot;start.sh&quot; file readable and executable for anyone on a
117UNIX system.</p>
118<blockquote><pre>
119&lt;chmod file=&quot;${dist}/start.sh&quot; perm=&quot;700&quot;/&gt;
120</pre></blockquote>
121<p>makes the &quot;start.sh&quot; file readable, writable and executable only for the owner on a
122UNIX system.</p>
123<blockquote>
124<pre>
125&lt;chmod dir=&quot;${dist}/bin&quot; perm=&quot;ugo+rx&quot;
126 includes=&quot;**/*.sh&quot;/&gt;
127</pre>
128</blockquote>
129<p>makes all &quot;.sh&quot; files below <code>${dist}/bin</code>
130readable and executable for anyone on a UNIX system.</p>
131<blockquote>
132<pre>
133&lt;chmod perm=&quot;g+w&quot;&gt;
134 &lt;fileset dir=&quot;shared/sources1&quot;&gt;
135 &lt;exclude name=&quot;**/trial/**&quot;/&gt;
136 &lt;/fileset&gt;
137 &lt;fileset refid=&quot;other.shared.sources&quot;/&gt;
138&lt;/chmod&gt;
139</pre>
140</blockquote>
141<p>makes all files below <code>shared/sources1</code> (except those
142below any directory named trial) writable for members of the same
143group on a UNIX system. In addition all files belonging to a FileSet
144with <code>id</code> <code>other.shared.sources</code> get the same
145permissions.</p>
146
147<blockquote>
148<pre>
149&lt;chmod perm=&quot;go-rwx&quot; type=&quot;file&quot;&gt;
150 &lt;fileset dir=&quot;/web&quot;&gt;
151 &lt;include name=&quot;**/*.cgi&quot;/&gt;
152 &lt;include name=&quot;**/*.old&quot;/&gt;
153 &lt;/fileset&gt;
154 &lt;dirset dir=&quot;/web&quot;&gt;
155 &lt;include name=&quot;**/private_*&quot;/&gt;
156 &lt;/dirset&gt;
157&lt;/chmod&gt;
158</pre>
159</blockquote>
160
161<p>keeps non-owners from touching cgi scripts, files with a <code>.old</code>
162extension or directories beginning with <code>private_</code>. A directory
163ending in <code>.old</code> or a file beginning with private_ would remain
164unaffected.</p>
165
166<hr>
167<p align="center">Copyright &copy; 2000-2005 The Apache Software Foundation.
168All rights Reserved.</p>
169
170</body>
171</html>
172
Note: See TracBrowser for help on using the repository browser.