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

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