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.

delete.html 5.7 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Language" content="en-us">
  4. <title>Delete Task</title>
  5. </head>
  6. <body>
  7. <h2><a name="delete">Delete</a></h2>
  8. <h3>Description</h3>
  9. <p>Deletes a single file, a specified directory and all its files and
  10. subdirectories, or a set of files specified by one or more
  11. <a href="../CoreTypes/fileset.html">FileSet</a>s.
  12. When specifying a set of files, empty directories are <i>not</i> removed by
  13. default.
  14. To remove empty directories, use the <code>includeEmptyDirs</code> attribute.
  15. </p>
  16. <h3>Parameters</h3>
  17. <table border="1" cellpadding="2" cellspacing="0">
  18. <tr>
  19. <td valign="top"><b>Attribute</b></td>
  20. <td valign="top"><b>Description</b></td>
  21. <td align="center" valign="top"><b>Required</b></td>
  22. </tr>
  23. <tr>
  24. <td valign="top">file</td>
  25. <td valign="top">The file to delete, specified as either the simple
  26. filename (if the file exists in the current base directory), a
  27. relative-path filename, or a full-path filename.</td>
  28. <td align="center" valign="middle" rowspan="2">At least one of the two,
  29. unless a <code>&lt;fileset&gt;</code> is specified.</td>
  30. </tr>
  31. <tr>
  32. <td valign="top">dir</td>
  33. <td valign="top">The directory to delete, including all its files and
  34. subdirectories.<br>
  35. <b>Note:</b> <code>dir</code> is <em>not</em> used
  36. to specify a directory name for <code>file</code>; <code>file</code>
  37. and <code>dir</code> are independent of each other.<br>
  38. <b>WARNING:</b> Do <b>not</b> set <code>dir</code> to
  39. <code>&quot;.&quot;</code>, <code>&quot;${basedir}&quot;</code>,
  40. or the full-pathname equivalent unless you truly <em>intend</em> to
  41. recursively remove the entire contents of the current base directory
  42. (and the base directory itself, if different from the current working
  43. directory).</td>
  44. </tr>
  45. <tr>
  46. <td valign="top">verbose</td>
  47. <td valign="top">Show the name of each deleted file (&quot;true&quot;/&quot;false&quot;).
  48. Default is &quot;false&quot; when omitted.</td>
  49. <td align="center" valign="top">No</td>
  50. </tr>
  51. <tr>
  52. <td valign="top">quiet</td>
  53. <td valign="top">If the specified file or directory does not exist,
  54. do not display a diagnostic message (unless Ant
  55. has been invoked with the <code>&#x2011;verbose</code> or
  56. <code>&#x2011;debug</code> switches) or modify the exit status to
  57. reflect an error.
  58. When set to &quot;true&quot;, if a file or directory cannot be deleted,
  59. no error is reported. This setting emulates the
  60. <code>-f</code> option to the Unix <em>rm</em> command.
  61. Default is &quot;false&quot;.
  62. Setting this to &quot;true&quot; implies setting
  63. <code>failonerror</code> to &quot;false&quot;.
  64. </td>
  65. <td align="center" valign="top">No</td>
  66. </tr>
  67. <tr>
  68. <td valign="top">failonerror</td>
  69. <td valign="top">
  70. Controls whether an error (such as a failure to delete a file)
  71. stops the build or is merely reported to the screen.
  72. Only relevant if <code>quiet</code> is &quot;false&quot;.
  73. Default is &quot;true&quot;.
  74. </td>
  75. <td align="center" valign="top">No</td>
  76. </tr>
  77. <tr>
  78. <td valign="top">includeEmptyDirs</td>
  79. <td valign="top">Set to &quot;true&quot; to delete empty directories when
  80. using filesets. Default is &quot;false&quot;.</td>
  81. <td align="center" valign="top">No</td>
  82. </tr>
  83. <tr>
  84. <td valign="top">includes</td>
  85. <td valign="top"><em>Deprecated.</em> Use <code>&lt;fileset&gt;</code>.
  86. Comma-separated list of patterns of
  87. files that must be deleted. All files are relative to the directory
  88. specified in <code>dir</code>.
  89. </td>
  90. <td valign="top" align="center">No</td>
  91. </tr>
  92. <tr>
  93. <td valign="top">includesfile</td>
  94. <td valign="top"><em>Deprecated.</em> Use <code>&lt;fileset&gt;</code>.
  95. The name of a file. Each line of
  96. this file is taken to be an include pattern</td>
  97. <td valign="top" align="center">No</td>
  98. </tr>
  99. <tr>
  100. <td valign="top">excludes</td>
  101. <td valign="top"><em>Deprecated.</em> Use <code>&lt;fileset&gt;</code>.
  102. Comma-separated list of patterns of
  103. files that must be excluded from the deletion list.
  104. All files are relative to the directory specified in <code>dir</code>.
  105. No files (except default excludes) are excluded when omitted.</td>
  106. <td valign="top" align="center">No</td>
  107. </tr>
  108. <tr>
  109. <td valign="top">excludesfile</td>
  110. <td valign="top"><em>Deprecated.</em> Use <code>&lt;fileset&gt;</code>.
  111. The name of a file. Each line of
  112. this file is taken to be an exclude pattern</td>
  113. <td valign="top" align="center">No</td>
  114. </tr>
  115. <tr>
  116. <td valign="top">defaultexcludes</td>
  117. <td valign="top"> Use <code>&lt;fileset&gt;</code>.
  118. Indicates whether default excludes
  119. should be used or not (&quot;yes&quot;/&quot;no&quot;). Default excludes
  120. are used when omitted.</td>
  121. <td valign="top" align="center">No</td>
  122. </tr>
  123. </table>
  124. <h3>Examples</h3>
  125. <pre> &lt;delete file=&quot;/lib/ant.jar&quot;/&gt;</pre>
  126. <p>deletes the file <code>/lib/ant.jar</code>.</p>
  127. <pre> &lt;delete dir=&quot;lib&quot;/&gt;</pre>
  128. <p>deletes the <code>lib</code> directory, including all files
  129. and subdirectories of <code>lib</code>.</p>
  130. <pre> &lt;delete&gt;
  131. &lt;fileset dir=&quot;.&quot; includes=&quot;**/*.bak&quot;/&gt;
  132. &lt;/delete&gt;
  133. </pre>
  134. <p>deletes all files with the extension <code>.bak</code> from the current directory
  135. and any subdirectories.</p>
  136. <pre> &lt;delete includeEmptyDirs=&quot;true&quot; &gt;
  137. &lt;fileset dir=&quot;build&quot; /&gt;
  138. &lt;/delete&gt;
  139. </pre>
  140. <p>deletes all files and subdirectories of <code>build</code>, including
  141. <code>build</code> itself.</p>
  142. <hr><p align="center">Copyright &copy; 2001-2002 Apache Software Foundation.
  143. All rights Reserved.</p>
  144. </body>
  145. </html>