Deletes a single file, a specified directory and all its files and
subdirectories, or a set of files specified by one or more
FileSets.
When specifying a set of files, empty directories are not removed by
default.
To remove empty directories, use the includeEmptyDirs attribute.
| Attribute | Description | Required |
| file | The file to delete. | At least one of the two, unless a <fileset> is specified. |
| dir | The directory to delete, including all its files and subdirectories. | |
| verbose | Show the name of each deleted file ("true"/"false"). Default is "false" when omitted. | No |
| quiet | If the file does not exist, do not display a diagnostic
message (unless Ant
has been invoked with the ‑verbose or
‑debug switches) or modify the exit status to
reflect an error.
When set to "true", if a file or directory cannot be deleted,
no error is reported. This setting emulates the
-f option to the Unix rm command.
Default is "false".
Setting this to "true" implies setting
failonerror to "false".
|
No |
| failonerror |
Controls whether an error (such as a failure to delete a file)
stops the build or is merely reported to the screen.
Only relevant if quiet is "false".
Default is "true".
|
No |
| includeEmptyDirs | Set to "true" to delete empty directories when using filesets. Default is "false". | No |
<delete file="/lib/ant.jar"/>
deletes the file /lib/ant.jar.
<delete dir="lib"/>
deletes the lib directory, including all files
and subdirectories of lib.
<delete>
<fileset dir="." includes="**/*.bak"/>
</delete>
deletes all files with the extension .bak from the current directory
and any subdirectories.
<delete includeEmptyDirs="true" >
<fileset dir="build" />
</delete>
deletes all files and subdirectories of build, including
build itself.
Copyright © 2001-2002 Apache Software Foundation. All rights Reserved.