B.12 DeleteTask
Prev | Appendix B. Core tasks | Next

## B.12 DeleteTask

Deletes a file or directory, or set of files defined by a fileset. See Appendix D, Core Types for information on Filesets.

Table B.13: Attributes

Name | Type | Description | Default | Required
--- | --- | --- | --- | ---
`file` | `String` | The file that is to be deleted. You either have to specify this attribute, `dir`, or use a fileset. | n/a | Yes (or `dir`)
`dir` | `String` | The directory that is to be deleted. You either have to specify this attribute, `file`, or use a fileset. | n/a | Yes (or `file`)
`verbose` | `Boolean` | Used to force listing of all names of deleted files. | n/a | No
`quiet` | `Boolean` | If the file does not exist, do not display a diagnostic message or modify the exit status to reflect an error. This means that if a file or directory cannot be deleted, then no error is reported. This setting emulates the -f option to the Unix `rm` command. Default is false meaning things are verbose | n/a | No
`failonerror` | `Boolean` | If this attribute is set to `true`, DeleteTask will verbose on errors but the build process will not be stopped. | `false` | No
`includeemptydirs` | `Boolean` | Determines if empty directories are also to be deleted. | `false` | No

### B.12.1 Examples

    <!-- Delete a specific file -->
    <delete file="/tmp/foo.bar" />

    <!-- Delete a directory -->
    <delete dir="/tmp/darl" includeemptydirs="true" verbose="true" failonerror="true" />

    <!-- Delete using a fileset -->
    <delete>
      <fileset dir="/tmp">
        <include name="*.bar" />
      </fileset>
    </delete>

### B.12.2 Supported Nested Tags

- `fileset`

Prev | Up | Next
B.11 CvsPassTask | Home | B.13 EchoTask