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.

attrib.html 5.3 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  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>Ant User Manual</title>
  20. </head>
  21. <body>
  22. <h2><a name="attrib">Attrib</a></h2>
  23. <p><em>Since Ant 1.6.</em></p>
  24. <h3>Description</h3>
  25. <p>Changes the attributes of a file or all files inside specified
  26. directories. Right now it has effect only under Windows. Each of the
  27. 4 possible permissions has its own attribute, matching the arguments
  28. for the attrib 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. attrib command. If you are working on a large number of files this
  39. may result in a command line that is too long for your operating
  40. system. If you encounter such problems, you should set the
  41. maxparallel attribute of this task to a non-zero value. The number to
  42. use highly depends on the length of your file names (the depth of your
  43. directory tree), so you'll have to experiment a little.</p>
  44. <h3>Parameters</h3>
  45. <table border="1" cellpadding="2" cellspacing="0">
  46. <tr>
  47. <td valign="top"><b>Attribute</b></td>
  48. <td valign="top"><b>Description</b></td>
  49. <td align="center" valign="top"><b>Required</b></td>
  50. </tr>
  51. <tr>
  52. <td valign="top">file</td>
  53. <td valign="top">the file or directory of which the permissions must be
  54. changed.</td>
  55. <td valign="top" valign="middle">Yes or nested
  56. <code>&lt;fileset/list&gt;</code> elements.</td>
  57. </tr>
  58. <tr>
  59. <td valign="top">readonly</td>
  60. <td valign="top">the readonly permission.</td>
  61. <td valign="top" rowspan="4">at least one of the four. </td>
  62. </tr>
  63. <tr>
  64. <td valign="top">archive</td>
  65. <td valign="top">the archive permission.</td>
  66. </tr>
  67. <tr>
  68. <td valign="top">system</td>
  69. <td valign="top">the system permission.</td>
  70. </tr>
  71. <tr>
  72. <td valign="top">hidden</td>
  73. <td valign="top">the hidden permission.</td>
  74. </tr>
  75. <tr>
  76. <td valign="top">type</td>
  77. <td valign="top">One of <i>file</i>, <i>dir</i> or <i>both</i>. If set to
  78. <i>file</i>, only the permissions of plain files are going to be changed.
  79. If set to <i>dir</i>, only the directories are considered.<br>
  80. <strong>Note:</strong> The type attribute does not apply to
  81. nested <i>dirset</i>s - <i>dirset</i>s always implicitly
  82. assume type to be <i>dir</i>.</td>
  83. <td align="center" valign="top">No, default is <i>file</i></td>
  84. </tr>
  85. <tr>
  86. <td valign="top">verbose</td>
  87. <td valign="top">Whether to print a summary after execution or not.
  88. Defaults to <code>false</code>.</td>
  89. <td align="center" valign="top">No</td>
  90. </tr>
  91. <tr>
  92. <td valign="top">parallel</td>
  93. <td valign="top">process all specified files using a single
  94. <code>chmod</code> command. Defaults to true.</td>
  95. <td valign="top" align="center">No</td>
  96. </tr>
  97. <tr>
  98. <td valign="top">maxparallel</td>
  99. <td valign="top">Limit the amount of parallelism by passing at
  100. most this many sourcefiles at once. Set it to &lt;= 0 for
  101. unlimited. Defaults to unlimited. <em>Since Ant 1.6.</em></td>
  102. <td align="center" valign="top">No</td>
  103. </tr>
  104. </table>
  105. <h3>Examples</h3>
  106. <blockquote>
  107. <pre>&lt;attrib file=&quot;${dist}/run.bat&quot; readonly=&quot;true&quot; hidden=&quot;true&quot;/&gt;</pre>
  108. </blockquote>
  109. <p>makes the &quot;run.bat&quot; file read-only and hidden.</p>
  110. <blockquote>
  111. <pre>&lt;attrib readonly=&quot;false&quot;&gt;
  112. &lt;fileset dir=&quot;${meta.inf}&quot; includes=&quot;**/*.xml&quot;/&gt;
  113. &lt;/attrib&gt;
  114. </pre>
  115. </blockquote>
  116. <p>makes all &quot;.xml&quot; files below <code>${meta.inf}</code> readable.</p>
  117. <blockquote>
  118. <pre>
  119. &lt;attrib readonly=&quot;true&quot; archive=&quot;true&quot;&gt;
  120. &lt;fileset dir=&quot;shared/sources1&quot;&gt;
  121. &lt;exclude name=&quot;**/trial/**&quot;/&gt;
  122. &lt;/fileset&gt;
  123. &lt;fileset refid=&quot;other.shared.sources&quot;/&gt;
  124. &lt;/attrib&gt;
  125. </pre>
  126. </blockquote>
  127. <p>makes all files below <code>shared/sources1</code> (except those below any
  128. directory named trial) read-only and archived. In addition all files belonging
  129. to a FileSet with <code>id</code> <code>other.shared.sources</code> get the
  130. same attributes.</p>
  131. </body>
  132. </html>