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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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>By default this task will use a single invocation of the underlying
  21. attrib command. If you are working on a large number of files this
  22. may result in a command line that is too long for your operating
  23. system. If you encounter such problems, you should set the
  24. maxparallel attribute of this task to a non-zero value. The number to
  25. use highly depends on the length of your file names (the depth of your
  26. directory tree), so you'll have to experiment a little.</p>
  27. <h3>Parameters</h3>
  28. <table border="1" cellpadding="2" cellspacing="0">
  29. <tr>
  30. <td valign="top"><b>Attribute</b></td>
  31. <td valign="top"><b>Description</b></td>
  32. <td align="center" valign="top"><b>Required</b></td>
  33. </tr>
  34. <tr>
  35. <td valign="top">file</td>
  36. <td valign="top">the file or directory of which the permissions must be
  37. changed.</td>
  38. <td valign="top" valign="middle">Yes or nested
  39. <code>&lt;fileset/list&gt;</code> elements.</td>
  40. </tr>
  41. <tr>
  42. <td valign="top">readonly</td>
  43. <td valign="top">the readonly permission.</td>
  44. <td valign="top" rowspan="4">at least one of the four. </td>
  45. </tr>
  46. <tr>
  47. <td valign="top">archive</td>
  48. <td valign="top">the archive permission.</td>
  49. </tr>
  50. <tr>
  51. <td valign="top">system</td>
  52. <td valign="top">the system permission.</td>
  53. </tr>
  54. <tr>
  55. <td valign="top">hidden</td>
  56. <td valign="top">the hidden permission.</td>
  57. </tr>
  58. <tr>
  59. <td valign="top">type</td>
  60. <td valign="top">One of <i>file</i>, <i>dir</i> or <i>both</i>. If set to
  61. <i>file</i>, only the permissions of plain files are going to be changed.
  62. If set to <i>dir</i>, only the directories are considered.<br>
  63. <strong>Note:</strong> The type attribute does not apply to
  64. nested <i>dirset</i>s - <i>dirset</i>s always implicitly
  65. assume type to be <i>dir</i>.</td>
  66. <td align="center" valign="top">No, default is <i>file</i></td>
  67. </tr>
  68. <tr>
  69. <td valign="top">verbose</td>
  70. <td valign="top">Whether to print a summary after execution or not.
  71. Defaults to <code>false</code>.</td>
  72. <td align="center" valign="top">No</td>
  73. </tr>
  74. </table>
  75. <h3>Examples</h3>
  76. <blockquote>
  77. <pre>&lt;attrib file=&quot;${dist}/run.bat&quot; readonly=&quot;true&quot; hidden=&quot;true&quot;/&gt;</pre>
  78. </blockquote>
  79. <p>makes the &quot;run.bat&quot; file read-only and hidden.</p>
  80. <blockquote>
  81. <pre>&lt;attrib readonly=&quot;false&quot;&gt;
  82. &lt;fileset dir=&quot;${meta.inf}&quot; includes=&quot;**/*.xml&quot;/&gt;
  83. &lt;attrib&gt;
  84. </pre>
  85. </blockquote>
  86. <p>makes all &quot;.xml&quot; files below <code>${meta.inf}</code> readable.</p>
  87. <blockquote>
  88. <pre>
  89. &lt;attrib readonly=&quot;true&quot; archive=&quot;true&quot;&gt;
  90. &lt;fileset dir=&quot;shared/sources1&quot;&gt;
  91. &lt;exclude name=&quot;**/trial/**&quot;/&gt;
  92. &lt;/fileset&gt;
  93. &lt;fileset refid=&quot;other.shared.sources&quot;/&gt;
  94. &lt;/attrib&gt;
  95. </pre>
  96. </blockquote>
  97. <p>makes all files below <code>shared/sources1</code> (except those below any
  98. directory named trial) read-only and archived. In addition all files belonging
  99. to a FileSet with <code>id</code> <code>other.shared.sources</code> get the
  100. same attributes.</p>
  101. <hr>
  102. <p align="center">Copyright &copy; 2002-2003,2005 Apache Software
  103. Foundation. All rights Reserved.</p>
  104. </body>
  105. </html>