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.0 KiB

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