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.

chown.html 4.2 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Language" content="en-us">
  4. <title>Chown Task</title>
  5. </head>
  6. <body>
  7. <h2><a name="Chown">Chown</a></h2>
  8. <p><em>Since Ant 1.6.</em></p>
  9. <h3>Description</h3>
  10. <p>Changes the owner of a file or all files inside specified
  11. directories. Right now it has effect only under Unix. The owner
  12. attribute is equivalent to the corresponding argument for the chown
  13. command.</p>
  14. <p><a href="../CoreTypes/fileset.html">FileSet</a>s,
  15. <a href="../CoreTypes/dirset.html">DirSet</a>s or <a
  16. href="../CoreTypes/filelist.html">FileList</a>s can be specified using
  17. nested <code>&lt;fileset&gt;</code>, <code>&lt;dirset&gt;</code> and
  18. <code>&lt;filelist&gt;</code> elements.</p>
  19. <h3>Parameters</h3>
  20. <table border="1" cellpadding="2" cellspacing="0">
  21. <tr>
  22. <td valign="top"><b>Attribute</b></td>
  23. <td valign="top"><b>Description</b></td>
  24. <td align="center" valign="top"><b>Required</b></td>
  25. </tr>
  26. <tr>
  27. <td valign="top">file</td>
  28. <td valign="top">the file or directory of which the owner must be
  29. changed.</td>
  30. <td valign="top" valign="middle">Yes or nested
  31. <code>&lt;fileset/list&gt;</code> elements.</td>
  32. </tr>
  33. <tr>
  34. <td valign="top">owner</td>
  35. <td valign="top">the new owner.</td>
  36. <td valign="top" align="center">Yes</td>
  37. </tr>
  38. <tr>
  39. <td valign="top">parallel</td>
  40. <td valign="top">process all specified files using a single
  41. <code>chown</code> command. Defaults to true.</td>
  42. <td valign="top" align="center">No</td>
  43. </tr>
  44. <tr>
  45. <td valign="top">type</td>
  46. <td valign="top">One of <i>file</i>, <i>dir</i> or
  47. <i>both</i>. If set to <i>file</i>, only the owner of
  48. plain files are going to be changed. If set to <i>dir</i>, only
  49. the directories are considered.<br>
  50. <strong>Note:</strong> The type attribute does not apply to
  51. nested <i>dirset</i>s - <i>dirset</i>s always implicitly
  52. assume type to be <i>dir</i>.</td>
  53. <td align="center" valign="top">No, default is <i>file</i></td>
  54. </tr>
  55. <tr>
  56. <td valign="top">maxparallel</td>
  57. <td valign="top">Limit the amount of parallelism by passing at
  58. most this many sourcefiles at once. Set it to &lt;= 0 for
  59. unlimited. Defaults to unlimited.</td>
  60. <td align="center" valign="top">No</td>
  61. </tr>
  62. <tr>
  63. <td valign="top">verbose</td>
  64. <td valign="top">Whether to print a summary after execution or not.
  65. Defaults to <code>false</code>.</td>
  66. <td align="center" valign="top">No</td>
  67. </tr>
  68. </table>
  69. <h3>Examples</h3>
  70. <blockquote>
  71. <p><code>&lt;chown file=&quot;${dist}/start.sh&quot; owner=&quot;coderjoe&quot;/&gt;</code></p>
  72. </blockquote>
  73. <p>makes the &quot;start.sh&quot; file belong to coderjoe on a
  74. UNIX system.</p>
  75. <blockquote>
  76. <pre>
  77. &lt;chown owner=&quot;coderjoe&quot;&gt;
  78. &lt;fileset dir=&quot;${dist}/bin&quot; includes=&quot;**/*.sh&quot;/&gt;
  79. &lt;/chown&gt;
  80. </pre>
  81. </blockquote>
  82. <p>makes all &quot;.sh&quot; files below <code>${dist}/bin</code>
  83. belong to coderjoe on a UNIX system.</p>
  84. <blockquote>
  85. <pre>
  86. &lt;chown owner=&quot;coderjoe&quot;&gt;
  87. &lt;fileset dir=&quot;shared/sources1&quot;&gt;
  88. &lt;exclude name=&quot;**/trial/**&quot;/&gt;
  89. &lt;/fileset&gt;
  90. &lt;fileset refid=&quot;other.shared.sources&quot;/&gt;
  91. &lt;/chown&gt;
  92. </pre>
  93. </blockquote>
  94. <p>makes all files below <code>shared/sources1</code> (except those
  95. below any directory named trial) belong to coderjoe on a UNIX
  96. system. In addition all files belonging to a FileSet
  97. with <code>id</code> <code>other.shared.sources</code> get the same
  98. owner.</p>
  99. <blockquote>
  100. <pre>
  101. &lt;chown owner=&quot;webadmin&quot; type=&quot;file&quot;&gt;
  102. &lt;fileset dir=&quot;/web&quot;&gt;
  103. &lt;include name=&quot;**/*.cgi&quot;/&gt;
  104. &lt;include name=&quot;**/*.old&quot;/&gt;
  105. &lt;/fileset&gt;
  106. &lt;dirset dir=&quot;/web&quot;&gt;
  107. &lt;include name=&quot;**/private_*&quot;/&gt;
  108. &lt;/dirset&gt;
  109. &lt;/chmod&gt;
  110. </pre>
  111. </blockquote>
  112. <p>makes cgi scripts, files with a <code>.old</code> extension or
  113. directories beginning with <code>private_</code> belong to the user named
  114. webadmin. A directory ending in <code>.old</code> or a file beginning with
  115. <code>private_</code> would remain unaffected.</p>
  116. <hr>
  117. <p align="center">Copyright &copy; 2002-2003 Apache Software
  118. Foundation. All rights Reserved.</p>
  119. </body>
  120. </html>