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 4.6 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="delete">Delete</a></h2>
  8. <h3>Description</h3>
  9. <p>Deletes either a single file, all files in a specified directory and its
  10. sub-directories, or a set of files specified by one or more <a href="../CoreTypes/fileset.html">FileSet</a>s.
  11. When specifying a set of files, empty directories are <i>not</i> removed by default.
  12. To remove empty directories, use the <em>includeEmptyDirs</em> atribute.</p>
  13. <h3>Parameters</h3>
  14. <table border="1" cellpadding="2" cellspacing="0">
  15. <tr>
  16. <td valign="top"><b>Attribute</b></td>
  17. <td valign="top"><b>Description</b></td>
  18. <td align="center" valign="top"><b>Required</b></td>
  19. </tr>
  20. <tr>
  21. <td valign="top">file</td>
  22. <td valign="top">The file to delete.</td>
  23. <td align="center" valign="middle" rowspan="2">at least one of the two</td>
  24. </tr>
  25. <tr>
  26. <td valign="top">dir</td>
  27. <td valign="top">The directory to delete files from.</td>
  28. </tr>
  29. <tr>
  30. <td valign="top">verbose</td>
  31. <td valign="top">Show name of each deleted file (&quot;true&quot;/&quot;false&quot;).
  32. Default is &quot;false&quot; when omitted.</td>
  33. <td align="center" valign="top">No</td>
  34. </tr>
  35. <tr>
  36. <td valign="top">quiet</td>
  37. <td valign="top">If the file does not exist, do not display a diagnostic
  38. message or modify the exit status to reflect an error (unless Ant
  39. has been invoked with the -verbose or -debug switches).
  40. This means that if a file or directory cannot be deleted,
  41. then no error is reported. This setting emulates the
  42. -f option to the Unix &quot;rm&quot; command.
  43. (&quot;true&quot;/&quot;false&quot;).
  44. Default is &quot;false&quot; meaning things are &quot;noisy&quot;.</td>
  45. Setting this to true, implies setting failonerror to false.
  46. <td align="center" valign="top">No</td>
  47. </tr>
  48. <tr>
  49. <td valign="top">failonerror</td>
  50. <td valign="top">
  51. This flag (which is only of relevance if 'quiet' is false),
  52. controls whether an error -such as a failure to delete a file-
  53. stops the build task, or is merely reported to the screen.
  54. The default is &quot;true&quot;
  55. </td>
  56. <td align="center" valign="top">No</td>
  57. </tr>
  58. <tr>
  59. <td valign="top">includeEmptyDirs</td>
  60. <td valign="top">Set to &quot;true&quot; to delete empty directories when
  61. using filesets. Default is &quot;false&quot;.</td>
  62. <td align="center" valign="top">No</td>
  63. </tr>
  64. <tr>
  65. <td valign="top">includes</td>
  66. <td valign="top"><i>Deprecated.</i> Comma separated list of patterns of files that must be
  67. deleted. All files are in the current directory
  68. and any sub-directories are deleted when omitted.</td>
  69. <td valign="top" align="center">No</td>
  70. </tr>
  71. <tr>
  72. <td valign="top">includesfile</td>
  73. <td valign="top"><i>Deprecated.</i> The name of a file. Each line of this file is
  74. taken to be an include pattern</td>
  75. <td valign="top" align="center">No</td>
  76. </tr>
  77. <tr>
  78. <td valign="top">excludes</td>
  79. <td valign="top"><i>Deprecated.</i> Comma separated list of patterns of files that must be
  80. excluded from the deletion list. No files (except default excludes) are excluded when omitted.</td>
  81. <td valign="top" align="center">No</td>
  82. </tr>
  83. <tr>
  84. <td valign="top">excludesfile</td>
  85. <td valign="top"><i>Deprecated.</i> The name of a file. Each line of this file is
  86. taken to be an exclude pattern</td>
  87. <td valign="top" align="center">No</td>
  88. </tr>
  89. <tr>
  90. <td valign="top">defaultexcludes</td>
  91. <td valign="top"><i>Deprecated.</i> Indicates whether default excludes should be used or not
  92. (&quot;yes&quot;/&quot;no&quot;). Default excludes are used when omitted.</td>
  93. <td valign="top" align="center">No</td>
  94. </tr>
  95. </table>
  96. <h3>Examples</h3>
  97. <pre> &lt;delete file=&quot;/lib/ant.jar&quot;/&gt;</pre>
  98. <p>deletes the file <code>/lib/ant.jar</code>.</p>
  99. <pre> &lt;delete dir=&quot;lib&quot;/&gt;</pre>
  100. <p>deletes the <code>lib</code> directory, including all files
  101. and subdirectories of <code>lib</code>.</p>
  102. <pre> &lt;delete&gt;
  103. &lt;fileset dir=&quot;.&quot; includes=&quot;**/*.bak&quot;/&gt;
  104. &lt;/delete&gt;
  105. </pre>
  106. <p>deletes all files with the extension &quot;<code>.bak</code>&quot from the current directory
  107. and any sub-directories.</p>
  108. <pre> &lt;delete includeEmptyDirs=&quot;true&quot; &gt;
  109. &lt;fileset dir=&quot;build&quot; /&gt;
  110. &lt;/delete&gt;
  111. </pre>
  112. <p>deletes all files and subdirectories of <code>build</code>, including
  113. <code>build</code> itself.</p>
  114. <hr><p align="center">Copyright &copy; 2000,2001 Apache Software Foundation. All rights
  115. Reserved.</p>
  116. </body>
  117. </html>