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 5.9 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  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. <h3>Parameters</h3>
  48. <table border="1" cellpadding="2" cellspacing="0">
  49. <tr>
  50. <td valign="top"><b>Attribute</b></td>
  51. <td valign="top"><b>Description</b></td>
  52. <td align="center" valign="top"><b>Required</b></td>
  53. </tr>
  54. <tr>
  55. <td valign="top">file</td>
  56. <td valign="top">the file or directory of which the group must be
  57. changed.</td>
  58. <td valign="top" valign="middle">Yes, unless nested
  59. <code>&lt;fileset|filelist|dirset&gt;</code>
  60. elements are specified</td>
  61. </tr>
  62. <tr>
  63. <td valign="top">group</td>
  64. <td valign="top">the new group.</td>
  65. <td valign="top" align="center">Yes</td>
  66. </tr>
  67. <tr>
  68. <td valign="top">parallel</td>
  69. <td valign="top">process all specified files using a single
  70. <code>chgrp</code> command. Defaults to true.</td>
  71. <td valign="top" align="center">No</td>
  72. </tr>
  73. <tr>
  74. <td valign="top">type</td>
  75. <td valign="top">One of <i>file</i>, <i>dir</i> or
  76. <i>both</i>. If set to <i>file</i>, only the group of
  77. plain files are going to be changed. If set to <i>dir</i>, only
  78. the directories are considered.<br>
  79. <strong>Note:</strong> The type attribute does not apply to
  80. nested <i>dirset</i>s - <i>dirset</i>s always implicitly
  81. assume type to be <i>dir</i>.</td>
  82. <td align="center" valign="top">No, default is <i>file</i></td>
  83. </tr>
  84. <tr>
  85. <td valign="top">maxparallel</td>
  86. <td valign="top">Limit the amount of parallelism by passing at
  87. most this many sourcefiles at once. Set it to &lt;= 0 for
  88. unlimited. Defaults to unlimited.</td>
  89. <td align="center" valign="top">No</td>
  90. </tr>
  91. <tr>
  92. <td valign="top">verbose</td>
  93. <td valign="top">Whether to print a summary after execution or not.
  94. Defaults to <code>false</code>.</td>
  95. <td align="center" valign="top">No</td>
  96. </tr>
  97. </table>
  98. <h3>Examples</h3>
  99. <blockquote><pre>
  100. &lt;chgrp file=&quot;${dist}/start.sh&quot; group=&quot;coders&quot;/&gt;
  101. </pre>
  102. </blockquote>
  103. <p>makes the &quot;start.sh&quot; file belong to the coders group on a
  104. UNIX system.</p>
  105. <blockquote>
  106. <pre>
  107. &lt;chgrp group=&quot;coders&quot;&gt;
  108. &lt;fileset dir=&quot;${dist}/bin&quot; includes=&quot;**/*.sh&quot;/&gt;
  109. &lt;/chgrp&gt;
  110. </pre>
  111. </blockquote>
  112. <p>makes all &quot;.sh&quot; files below <code>${dist}/bin</code>
  113. belong to the coders group on a UNIX system.</p>
  114. <blockquote>
  115. <pre>
  116. &lt;chgrp group=&quot;coders&quot;&gt;
  117. &lt;fileset dir=&quot;shared/sources1&quot;&gt;
  118. &lt;exclude name=&quot;**/trial/**&quot;/&gt;
  119. &lt;/fileset&gt;
  120. &lt;fileset refid=&quot;other.shared.sources&quot;/&gt;
  121. &lt;/chgrp&gt;
  122. </pre>
  123. </blockquote>
  124. <p>makes all files below <code>shared/sources1</code> (except those
  125. below any directory named trial) belong to the coders group on a UNIX
  126. system. In addition all files belonging to a FileSet
  127. with <code>id</code> <code>other.shared.sources</code> get the same
  128. group.</p>
  129. <blockquote>
  130. <pre>
  131. &lt;chgrp group=&quot;webdev&quot; type=&quot;file&quot;&gt;
  132. &lt;fileset dir=&quot;/web&quot;&gt;
  133. &lt;include name=&quot;**/*.test.jsp&quot;/&gt;
  134. &lt;include name=&quot;**/*.new&quot;/&gt;
  135. &lt;/fileset&gt;
  136. &lt;dirset dir=&quot;/web&quot;&gt;
  137. &lt;include name=&quot;**/test_*&quot;/&gt;
  138. &lt;/dirset&gt;
  139. &lt;/chmod&gt;
  140. </pre>
  141. </blockquote>
  142. <p>makes all <code>.test.jsp</code>, and <code>.new</code> files belong to
  143. group webdev. Directories beginning with <code>test_</code> also will belong
  144. to webdev, but if there is a directory that ends in <code>.new</code> or a file
  145. that begins with <code>test_</code> it will be unaffected.</p>
  146. </body>
  147. </html>