Name

delete

Synopsis

Deletes one or more files and directories.

Warning

This is the most dangerous task in Ant. You can very easily erase your entire project with a single tag: <delete dir="."/>.

Attributes

defaultexcludes (all, boolean, N)

Determines whether to use default excludes, as described in Chapter 4 under “FileSet DataType.” Defaults to true.

dir (all, File, *)

The directory to delete, including all its files and subdirectories. Somewhat surprisingly, this attribute has nothing to do with the file attribute or nested <fileset>. Specifically, it does not specify the directory where a file given in the file attribute is found. Instead, this attribute tells the task to “brutally” delete an entire directory tree.

excludes (all, String, N)

A comma-separated list of file patterns to exclude. These are in addition to the default excludes.

excludesfile (all, File, N)

The name of a file containing one exclude pattern per line.

failonerror (1.4, boolean, N)

If true, the build process fails when this task fails. Defaults to true.

file (all, File, *)

The name of a file to delete.

includeemptydirs (1.3, 1.4, boolean, N)

If true, directories are deleted even if they are empty. Relevant only when using nested <fileset>s. Defaults to false.

includes (all, String, N)

A comma-separated list of file patterns to include.

includesfile (all, File, N)

The name of a file containing one include pattern per line.

quiet (1.3, 1.4, boolean, N)

If true, do not fail if a file or directory cannot be deleted. Defaults ...

Get Ant: The Definitive Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.