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

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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.</td>
  26. <td align="center" valign="middle" rowspan="2">At least one of the two, unless a <code>&lt;fileset&gt;</code> is specified.</td>
  27. </tr>
  28. <tr>
  29. <td valign="top">dir</td>
  30. <td valign="top">The directory to delete, including all its files and subdirectories.</td>
  31. </tr>
  32. <tr>
  33. <td valign="top">verbose</td>
  34. <td valign="top">Show the name of each deleted file (&quot;true&quot;/&quot;false&quot;).
  35. Default is &quot;false&quot; when omitted.</td>
  36. <td align="center" valign="top">No</td>
  37. </tr>
  38. <tr>
  39. <td valign="top">quiet</td>
  40. <td valign="top">If the file does not exist, do not display a diagnostic
  41. message (unless Ant
  42. has been invoked with the <code>&#x2011;verbose</code> or
  43. <code>&#x2011;debug</code> switches) or modify the exit status to
  44. reflect an error.
  45. When set to &quot;true&quot;, if a file or directory cannot be deleted,
  46. no error is reported. This setting emulates the
  47. <code>-f</code> option to the Unix <em>rm</em> command.
  48. Default is &quot;false&quot;.
  49. Setting this to &quot;true&quot; implies setting
  50. <code>failonerror</code> to &quot;false&quot;.
  51. </td>
  52. <td align="center" valign="top">No</td>
  53. </tr>
  54. <tr>
  55. <td valign="top">failonerror</td>
  56. <td valign="top">
  57. Controls whether an error (such as a failure to delete a file)
  58. stops the build or is merely reported to the screen.
  59. Only relevant if <code>quiet</code> is &quot;false&quot;.
  60. Default is &quot;true&quot;.
  61. </td>
  62. <td align="center" valign="top">No</td>
  63. </tr>
  64. <tr>
  65. <td valign="top">includeEmptyDirs</td>
  66. <td valign="top">Set to &quot;true&quot; to delete empty directories when
  67. using filesets. Default is &quot;false&quot;.</td>
  68. <td align="center" valign="top">No</td>
  69. </tr>
  70. </table>
  71. <h3>Examples</h3>
  72. <pre> &lt;delete file=&quot;/lib/ant.jar&quot;/&gt;</pre>
  73. <p>deletes the file <code>/lib/ant.jar</code>.</p>
  74. <pre> &lt;delete dir=&quot;lib&quot;/&gt;</pre>
  75. <p>deletes the <code>lib</code> directory, including all files
  76. and subdirectories of <code>lib</code>.</p>
  77. <pre> &lt;delete&gt;
  78. &lt;fileset dir=&quot;.&quot; includes=&quot;**/*.bak&quot;/&gt;
  79. &lt;/delete&gt;
  80. </pre>
  81. <p>deletes all files with the extension <code>.bak</code> from the current directory
  82. and any subdirectories.</p>
  83. <pre> &lt;delete includeEmptyDirs=&quot;true&quot; &gt;
  84. &lt;fileset dir=&quot;build&quot; /&gt;
  85. &lt;/delete&gt;
  86. </pre>
  87. <p>deletes all files and subdirectories of <code>build</code>, including
  88. <code>build</code> itself.</p>
  89. <hr><p align="center">Copyright &copy; 2001-2002 Apache Software Foundation.
  90. All rights Reserved.</p>
  91. </body>
  92. </html>