You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

chgrp.html 6.6 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. <!--
  2. Licensed to the Apache Software Foundation (ASF) under one or more
  3. contributor license agreements. See the NOTICE file distributed with
  4. this work for additional information regarding copyright ownership.
  5. The ASF licenses this file to You under the Apache License, Version 2.0
  6. (the "License"); you may not use this file except in compliance with
  7. the License. You may obtain a copy of the License at
  8. http://www.apache.org/licenses/LICENSE-2.0
  9. Unless required by applicable law or agreed to in writing, software
  10. distributed under the License is distributed on an "AS IS" BASIS,
  11. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. See the License for the specific language governing permissions and
  13. limitations under the License.
  14. -->
  15. <html>
  16. <head>
  17. <meta http-equiv="Content-Language" content="en-us">
  18. <link rel="stylesheet" type="text/css" href="../stylesheets/style.css">
  19. <title>Chgrp Task</title>
  20. </head>
  21. <body>
  22. <h2><a name="Chgrp">Chgrp</a></h2>
  23. <p><em>Since Ant 1.6.</em></p>
  24. <h3>Description</h3>
  25. <p>Changes the group of a file or all files inside specified
  26. directories. Right now it has effect only under Unix. The group
  27. attribute is equivalent to the corresponding argument for the chgrp
  28. command.</p>
  29. <p><a href="../CoreTypes/fileset.html">FileSet</a>s,
  30. <a href="../CoreTypes/dirset.html">DirSet</a>s or <a
  31. href="../CoreTypes/filelist.html">FileList</a>s can be specified using
  32. nested <code>&lt;fileset&gt;</code>, <code>&lt;dirset&gt;</code> and
  33. <code>&lt;filelist&gt;</code> elements.</p>
  34. <p>Starting with Ant 1.7, this task supports arbitrary <a
  35. href="../CoreTypes/resources.html#collection">Resource Collection</a>s
  36. as nested elements.</p>
  37. <p>By default this task will use a single invocation of the underlying
  38. chgrp command. If you are working on a large number of files this may
  39. result in a command line that is too long for your operating system.
  40. If you encounter such problems, you should set the maxparallel
  41. attribute of this task to a non-zero value. The number to use highly
  42. depends on the length of your file names (the depth of your directory
  43. tree) and your operating system, so you'll have to experiment a
  44. little. POSIX recommends command line length limits of at least 4096
  45. characters, this may give you an approximation for the number you
  46. could use as initial value for these experiments.</p>
  47. <p>By default this task won't do anything unless it detects it is
  48. running on a Unix system. If you know for sure that you have a
  49. "chgrp" executable on your PATH that is command line compatible with
  50. the Unix command, you can use the task's os attribute and set its
  51. value to your current os.</p>
  52. <h3>Parameters</h3>
  53. <table border="1" cellpadding="2" cellspacing="0">
  54. <tr>
  55. <td valign="top"><b>Attribute</b></td>
  56. <td valign="top"><b>Description</b></td>
  57. <td align="center" valign="top"><b>Required</b></td>
  58. </tr>
  59. <tr>
  60. <td valign="top">file</td>
  61. <td valign="top">the file or directory of which the group must be
  62. changed.</td>
  63. <td valign="top" valign="middle">Yes, unless nested
  64. <code>&lt;fileset|filelist|dirset&gt;</code>
  65. elements are specified</td>
  66. </tr>
  67. <tr>
  68. <td valign="top">group</td>
  69. <td valign="top">the new group.</td>
  70. <td valign="top" align="center">Yes</td>
  71. </tr>
  72. <tr>
  73. <td valign="top">parallel</td>
  74. <td valign="top">process all specified files using a single
  75. <code>chgrp</code> command. Defaults to true.</td>
  76. <td valign="top" align="center">No</td>
  77. </tr>
  78. <tr>
  79. <td valign="top">type</td>
  80. <td valign="top">One of <i>file</i>, <i>dir</i> or
  81. <i>both</i>. If set to <i>file</i>, only the group of
  82. plain files are going to be changed. If set to <i>dir</i>, only
  83. the directories are considered.<br>
  84. <strong>Note:</strong> The type attribute does not apply to
  85. nested <i>dirset</i>s - <i>dirset</i>s always implicitly
  86. assume type to be <i>dir</i>.</td>
  87. <td align="center" valign="top">No, default is <i>file</i></td>
  88. </tr>
  89. <tr>
  90. <td valign="top">maxparallel</td>
  91. <td valign="top">Limit the amount of parallelism by passing at
  92. most this many sourcefiles at once. Set it to &lt;= 0 for
  93. unlimited. Defaults to unlimited.</td>
  94. <td align="center" valign="top">No</td>
  95. </tr>
  96. <tr>
  97. <td valign="top">verbose</td>
  98. <td valign="top">Whether to print a summary after execution or not.
  99. Defaults to <code>false</code>.</td>
  100. <td align="center" valign="top">No</td>
  101. </tr>
  102. <tr>
  103. <td valign="top">os</td>
  104. <td valign="top">list of Operating Systems on which the command may be
  105. executed.</td>
  106. <td align="center" valign="top">No</td>
  107. </tr>
  108. <tr>
  109. <td valign="top">osfamily</td>
  110. <td valign="top">OS family as used in
  111. the <a href="../CoreTasks/conditions.html#os">&lt;os&gt;</a>
  112. condition.</td>
  113. <td align="center" valign="top">No - defaults to "unix"</td>
  114. </tr>
  115. </table>
  116. <h3>Examples</h3>
  117. <blockquote><pre>
  118. &lt;chgrp file=&quot;${dist}/start.sh&quot; group=&quot;coders&quot;/&gt;
  119. </pre>
  120. </blockquote>
  121. <p>makes the &quot;start.sh&quot; file belong to the coders group on a
  122. UNIX system.</p>
  123. <blockquote>
  124. <pre>
  125. &lt;chgrp group=&quot;coders&quot;&gt;
  126. &lt;fileset dir=&quot;${dist}/bin&quot; includes=&quot;**/*.sh&quot;/&gt;
  127. &lt;/chgrp&gt;
  128. </pre>
  129. </blockquote>
  130. <p>makes all &quot;.sh&quot; files below <code>${dist}/bin</code>
  131. belong to the coders group on a UNIX system.</p>
  132. <blockquote>
  133. <pre>
  134. &lt;chgrp group=&quot;coders&quot;&gt;
  135. &lt;fileset dir=&quot;shared/sources1&quot;&gt;
  136. &lt;exclude name=&quot;**/trial/**&quot;/&gt;
  137. &lt;/fileset&gt;
  138. &lt;fileset refid=&quot;other.shared.sources&quot;/&gt;
  139. &lt;/chgrp&gt;
  140. </pre>
  141. </blockquote>
  142. <p>makes all files below <code>shared/sources1</code> (except those
  143. below any directory named trial) belong to the coders group on a UNIX
  144. system. In addition all files belonging to a FileSet
  145. with <code>id</code> <code>other.shared.sources</code> get the same
  146. group.</p>
  147. <blockquote>
  148. <pre>
  149. &lt;chgrp group=&quot;webdev&quot; type=&quot;file&quot;&gt;
  150. &lt;fileset dir=&quot;/web&quot;&gt;
  151. &lt;include name=&quot;**/*.test.jsp&quot;/&gt;
  152. &lt;include name=&quot;**/*.new&quot;/&gt;
  153. &lt;/fileset&gt;
  154. &lt;dirset dir=&quot;/web&quot;&gt;
  155. &lt;include name=&quot;**/test_*&quot;/&gt;
  156. &lt;/dirset&gt;
  157. &lt;/chmod&gt;
  158. </pre>
  159. </blockquote>
  160. <p>makes all <code>.test.jsp</code>, and <code>.new</code> files belong to
  161. group webdev. Directories beginning with <code>test_</code> also will belong
  162. to webdev, but if there is a directory that ends in <code>.new</code> or a file
  163. that begins with <code>test_</code> it will be unaffected.</p>
  164. </body>
  165. </html>