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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  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. <tr>
  71. <td valign="top">includes</td>
  72. <td valign="top"><em>Deprecated.</em> Use <code>&lt;fileset&gt;</code>.
  73. Comma-separated list of patterns of
  74. files that must be deleted. All files are relative to the directory
  75. specified in <code>dir</code>.
  76. </td>
  77. <td valign="top" align="center">No</td>
  78. </tr>
  79. <tr>
  80. <td valign="top">includesfile</td>
  81. <td valign="top"><em>Deprecated.</em> Use <code>&lt;fileset&gt;</code>.
  82. The name of a file. Each line of
  83. this file is taken to be an include pattern</td>
  84. <td valign="top" align="center">No</td>
  85. </tr>
  86. <tr>
  87. <td valign="top">excludes</td>
  88. <td valign="top"><em>Deprecated.</em> Use <code>&lt;fileset&gt;</code>.
  89. Comma-separated list of patterns of
  90. files that must be excluded from the deletion list.
  91. All files are relative to the directory specified in <code>dir</code>.
  92. No files (except default excludes) are excluded when omitted.</td>
  93. <td valign="top" align="center">No</td>
  94. </tr>
  95. <tr>
  96. <td valign="top">excludesfile</td>
  97. <td valign="top"><em>Deprecated.</em> Use <code>&lt;fileset&gt;</code>.
  98. The name of a file. Each line of
  99. this file is taken to be an exclude pattern</td>
  100. <td valign="top" align="center">No</td>
  101. </tr>
  102. <tr>
  103. <td valign="top">defaultexcludes</td>
  104. <td valign="top"> Use <code>&lt;fileset&gt;</code>.
  105. Indicates whether default excludes
  106. should be used or not (&quot;yes&quot;/&quot;no&quot;). Default excludes
  107. are used when omitted.</td>
  108. <td valign="top" align="center">No</td>
  109. </tr>
  110. </table>
  111. <h3>Examples</h3>
  112. <pre> &lt;delete file=&quot;/lib/ant.jar&quot;/&gt;</pre>
  113. <p>deletes the file <code>/lib/ant.jar</code>.</p>
  114. <pre> &lt;delete dir=&quot;lib&quot;/&gt;</pre>
  115. <p>deletes the <code>lib</code> directory, including all files
  116. and subdirectories of <code>lib</code>.</p>
  117. <pre> &lt;delete&gt;
  118. &lt;fileset dir=&quot;.&quot; includes=&quot;**/*.bak&quot;/&gt;
  119. &lt;/delete&gt;
  120. </pre>
  121. <p>deletes all files with the extension <code>.bak</code> from the current directory
  122. and any subdirectories.</p>
  123. <pre> &lt;delete includeEmptyDirs=&quot;true&quot; &gt;
  124. &lt;fileset dir=&quot;build&quot; /&gt;
  125. &lt;/delete&gt;
  126. </pre>
  127. <p>deletes all files and subdirectories of <code>build</code>, including
  128. <code>build</code> itself.</p>
  129. <hr><p align="center">Copyright &copy; 2001-2002 Apache Software Foundation.
  130. All rights Reserved.</p>
  131. </body>
  132. </html>