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.

chmod.html 4.3 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Language" content="en-us">
  4. <title>Apache Ant User Manual</title>
  5. </head>
  6. <body>
  7. <h2><a name="chmod">Chmod</a></h2>
  8. <h3>Description</h3>
  9. <p>Changes the permissions of a file or all files inside specified directories. Right now it has effect only under Unix.
  10. The permissions are also UNIX style, like the argument for the chmod command.</p>
  11. <p>See the section on <a href="../dirtasks.html#directorybasedtasks">directory based
  12. tasks</a>, on how the inclusion/exclusion of files works, and how to
  13. write patterns.</p>
  14. <p>This task holds an implicit <a href="../CoreTypes/fileset.html">FileSet</a> and
  15. supports all of FileSet's attributes and nested elements
  16. directly. More FileSets can be specified using nested
  17. <code>&lt;fileset&gt;</code> elements.</p>
  18. <h3>Parameters</h3>
  19. <table border="1" cellpadding="2" cellspacing="0">
  20. <tr>
  21. <td valign="top"><b>Attribute</b></td>
  22. <td valign="top"><b>Description</b></td>
  23. <td align="center" valign="top"><b>Required</b></td>
  24. </tr>
  25. <tr>
  26. <td valign="top">file</td>
  27. <td valign="top">the file or single directory of which the permissions
  28. must be changed.</td>
  29. <td valign="top" valign="middle" rowspan="2">exactly one of the two or nested <code>&lt;fileset&gt;</code> elements.</td>
  30. </tr>
  31. <tr>
  32. <td valign="top">dir</td>
  33. <td valign="top">the directory which holds the files whose permissions
  34. must be changed.</td>
  35. </tr>
  36. <tr>
  37. <td valign="top">perm</td>
  38. <td valign="top">the new permissions.</td>
  39. <td valign="top" align="center">Yes</td>
  40. </tr>
  41. <tr>
  42. <td valign="top">includes</td>
  43. <td valign="top">comma separated list of patterns of files that must be
  44. included.</td>
  45. <td valign="top" align="center">No</td>
  46. </tr>
  47. <tr>
  48. <td valign="top">includesfile</td>
  49. <td valign="top">the name of a file. Each line of this file is
  50. taken to be an include pattern</td>
  51. <td valign="top" align="center">No</td>
  52. </tr>
  53. <tr>
  54. <td valign="top">excludes</td>
  55. <td valign="top">comma separated list of patterns of files that must be
  56. excluded. No files (except default excludes) are excluded when omitted.</td>
  57. <td valign="top" align="center">No</td>
  58. </tr>
  59. <tr>
  60. <td valign="top">excludesfile</td>
  61. <td valign="top">the name of a file. Each line of this file is
  62. taken to be an exclude pattern</td>
  63. <td valign="top" align="center">No</td>
  64. </tr>
  65. <tr>
  66. <td valign="top">defaultexcludes</td>
  67. <td valign="top">indicates whether default excludes should be used or not
  68. (&quot;yes&quot;/&quot;no&quot;). Default excludes are used when omitted.</td>
  69. <td valign="top" align="center">No</td>
  70. </tr>
  71. <tr>
  72. <td valign="top">parallel</td>
  73. <td valign="top">process all specified files using a single
  74. <code>chmod</code> command. Defaults to true.</td>
  75. <td valign="top" align="center">No</td>
  76. </tr>
  77. <tr>
  78. <td valign="top">type</td>
  79. <td valign="top">One of <i>file</i>, <i>dir</i> or
  80. <i>both</i>. If set to <i>file</i>, only the permissions of
  81. plain files are going to be changed. If set to <i>dir</i>, only
  82. the directories are considered.</td>
  83. <td align="center" valign="top">No, default is <i>file</i></td>
  84. </tr>
  85. </table>
  86. <h3>Examples</h3>
  87. <blockquote>
  88. <p><code>&lt;chmod file=&quot;${dist}/start.sh&quot; perm=&quot;ugo+rx&quot;/&gt;</code></p>
  89. </blockquote>
  90. <p>makes the &quot;start.sh&quot; file readable and executable for anyone on a
  91. UNIX system.</p>
  92. <blockquote>
  93. <pre>
  94. &lt;chmod dir=&quot;${dist}/bin&quot; perm=&quot;ugo+rx&quot; includes=&quot;**/*.sh&quot;/&gt;
  95. </pre>
  96. </blockquote>
  97. <p>makes all &quot;.sh&quot; files below <code>${dist}/bin</code>
  98. readable and executable for anyone on a UNIX system.</p>
  99. <blockquote>
  100. <pre>
  101. &lt;chmod perm=&quot;g+w&quot;&gt;
  102. &lt;fileset dir=&quot;shared/sources1&quot;&gt;
  103. &lt;exclude name=&quot;**/trial/**&quot;/&gt;
  104. &lt;/fileset&gt;
  105. &lt;fileset refid=&quot;other.shared.sources&quot;/&gt;
  106. &lt;/chmod&gt;
  107. </pre>
  108. </blockquote>
  109. <p>makes all files below <code>shared/sources1</code> (except those
  110. below any directory named trial) writable for members of the same
  111. group on a UNIX system. In addition all files belonging to a FileSet
  112. with <code>id</code> <code>other.shared.sources</code> get the same
  113. permissions.</p>
  114. <hr><p align="center">Copyright &copy; 2001 Apache Software Foundation. All rights
  115. Reserved.</p>
  116. </body>
  117. </html>