2001-02-13 12:32:01 +00:00
|
|
|
<html>
|
|
|
|
|
|
|
|
<head>
|
|
|
|
<meta http-equiv="Content-Language" content="en-us">
|
2002-02-03 22:00:42 +00:00
|
|
|
<title>Delete Task</title>
|
2001-02-13 12:32:01 +00:00
|
|
|
</head>
|
|
|
|
|
|
|
|
<body>
|
|
|
|
|
|
|
|
<h2><a name="delete">Delete</a></h2>
|
|
|
|
<h3>Description</h3>
|
2002-02-05 20:21:59 +00:00
|
|
|
<p>Deletes a single file, a specified directory and all its files and
|
|
|
|
subdirectories, or a set of files specified by one or more
|
|
|
|
<a href="../CoreTypes/fileset.html">FileSet</a>s.
|
|
|
|
When specifying a set of files, empty directories are <i>not</i> removed by
|
|
|
|
default.
|
|
|
|
To remove empty directories, use the <code>includeEmptyDirs</code> attribute.
|
|
|
|
</p>
|
2002-02-28 18:45:15 +00:00
|
|
|
<p>
|
|
|
|
If you use this task to delete temporary files created by editors and it doesnt
|
|
|
|
seem to work, read up on the
|
|
|
|
<a href="../dirtasks.html#defaultexcludes">default exclusion set</a> then at the option
|
|
|
|
down below to disable this feature.
|
|
|
|
|
2001-02-13 12:32:01 +00:00
|
|
|
<h3>Parameters</h3>
|
|
|
|
<table border="1" cellpadding="2" cellspacing="0">
|
|
|
|
<tr>
|
|
|
|
<td valign="top"><b>Attribute</b></td>
|
|
|
|
<td valign="top"><b>Description</b></td>
|
|
|
|
<td align="center" valign="top"><b>Required</b></td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td valign="top">file</td>
|
2002-02-13 04:35:57 +00:00
|
|
|
<td valign="top">The file to delete, specified as either the simple
|
|
|
|
filename (if the file exists in the current base directory), a
|
|
|
|
relative-path filename, or a full-path filename.</td>
|
|
|
|
<td align="center" valign="middle" rowspan="2">At least one of the two,
|
|
|
|
unless a <code><fileset></code> is specified.</td>
|
2001-02-13 12:32:01 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td valign="top">dir</td>
|
2002-02-13 03:51:58 +00:00
|
|
|
<td valign="top">The directory to delete, including all its files and
|
2002-02-13 04:35:57 +00:00
|
|
|
subdirectories.<br>
|
|
|
|
<b>Note:</b> <code>dir</code> is <em>not</em> used
|
|
|
|
to specify a directory name for <code>file</code>; <code>file</code>
|
|
|
|
and <code>dir</code> are independent of each other.<br>
|
|
|
|
<b>WARNING:</b> Do <b>not</b> set <code>dir</code> to
|
2002-02-13 03:51:58 +00:00
|
|
|
<code>"."</code>, <code>"${basedir}"</code>,
|
|
|
|
or the full-pathname equivalent unless you truly <em>intend</em> to
|
|
|
|
recursively remove the entire contents of the current base directory
|
|
|
|
(and the base directory itself, if different from the current working
|
|
|
|
directory).</td>
|
2001-02-13 12:32:01 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td valign="top">verbose</td>
|
2002-02-05 20:21:59 +00:00
|
|
|
<td valign="top">Show the name of each deleted file ("true"/"false").
|
2001-02-13 12:32:01 +00:00
|
|
|
Default is "false" when omitted.</td>
|
|
|
|
<td align="center" valign="top">No</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td valign="top">quiet</td>
|
2002-02-13 04:35:57 +00:00
|
|
|
<td valign="top">If the specified file or directory does not exist,
|
|
|
|
do not display a diagnostic message (unless Ant
|
2002-02-05 20:21:59 +00:00
|
|
|
has been invoked with the <code>‑verbose</code> or
|
|
|
|
<code>‑debug</code> 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
|
|
|
|
<code>-f</code> option to the Unix <em>rm</em> command.
|
|
|
|
Default is "false".
|
|
|
|
Setting this to "true" implies setting
|
|
|
|
<code>failonerror</code> to "false".
|
|
|
|
</td>
|
2001-02-13 12:32:01 +00:00
|
|
|
<td align="center" valign="top">No</td>
|
|
|
|
</tr>
|
2001-07-27 08:24:59 +00:00
|
|
|
<tr>
|
|
|
|
<td valign="top">failonerror</td>
|
|
|
|
<td valign="top">
|
2002-02-05 20:21:59 +00:00
|
|
|
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 <code>quiet</code> is "false".
|
|
|
|
Default is "true".
|
2001-07-27 08:24:59 +00:00
|
|
|
</td>
|
|
|
|
<td align="center" valign="top">No</td>
|
|
|
|
</tr>
|
2001-02-13 12:32:01 +00:00
|
|
|
<tr>
|
|
|
|
<td valign="top">includeEmptyDirs</td>
|
|
|
|
<td valign="top">Set to "true" to delete empty directories when
|
|
|
|
using filesets. Default is "false".</td>
|
|
|
|
<td align="center" valign="top">No</td>
|
|
|
|
</tr>
|
2002-02-08 21:07:21 +00:00
|
|
|
<tr>
|
|
|
|
<td valign="top">includes</td>
|
|
|
|
<td valign="top"><em>Deprecated.</em> Use <code><fileset></code>.
|
|
|
|
Comma-separated list of patterns of
|
|
|
|
files that must be deleted. All files are relative to the directory
|
|
|
|
specified in <code>dir</code>.
|
|
|
|
</td>
|
|
|
|
<td valign="top" align="center">No</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td valign="top">includesfile</td>
|
|
|
|
<td valign="top"><em>Deprecated.</em> Use <code><fileset></code>.
|
|
|
|
The name of a file. Each line of
|
|
|
|
this file is taken to be an include pattern</td>
|
|
|
|
<td valign="top" align="center">No</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td valign="top">excludes</td>
|
|
|
|
<td valign="top"><em>Deprecated.</em> Use <code><fileset></code>.
|
|
|
|
Comma-separated list of patterns of
|
|
|
|
files that must be excluded from the deletion list.
|
|
|
|
All files are relative to the directory specified in <code>dir</code>.
|
|
|
|
No files (except default excludes) are excluded when omitted.</td>
|
|
|
|
<td valign="top" align="center">No</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td valign="top">excludesfile</td>
|
|
|
|
<td valign="top"><em>Deprecated.</em> Use <code><fileset></code>.
|
|
|
|
The name of a file. Each line of
|
|
|
|
this file is taken to be an exclude pattern</td>
|
|
|
|
<td valign="top" align="center">No</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td valign="top">defaultexcludes</td>
|
|
|
|
<td valign="top"> Use <code><fileset></code>.
|
|
|
|
Indicates whether default excludes
|
|
|
|
should be used or not ("yes"/"no"). Default excludes
|
|
|
|
are used when omitted.</td>
|
|
|
|
<td valign="top" align="center">No</td>
|
|
|
|
</tr>
|
2001-02-13 12:32:01 +00:00
|
|
|
</table>
|
|
|
|
<h3>Examples</h3>
|
|
|
|
<pre> <delete file="/lib/ant.jar"/></pre>
|
|
|
|
<p>deletes the file <code>/lib/ant.jar</code>.</p>
|
|
|
|
<pre> <delete dir="lib"/></pre>
|
|
|
|
<p>deletes the <code>lib</code> directory, including all files
|
|
|
|
and subdirectories of <code>lib</code>.</p>
|
|
|
|
<pre> <delete>
|
|
|
|
<fileset dir="." includes="**/*.bak"/>
|
|
|
|
</delete>
|
|
|
|
</pre>
|
2002-02-05 20:21:59 +00:00
|
|
|
<p>deletes all files with the extension <code>.bak</code> from the current directory
|
|
|
|
and any subdirectories.</p>
|
2001-02-13 12:32:01 +00:00
|
|
|
<pre> <delete includeEmptyDirs="true" >
|
|
|
|
<fileset dir="build" />
|
|
|
|
</delete>
|
|
|
|
</pre>
|
2001-08-30 13:23:14 +00:00
|
|
|
<p>deletes all files and subdirectories of <code>build</code>, including
|
2001-02-13 12:32:01 +00:00
|
|
|
<code>build</code> itself.</p>
|
2002-02-05 20:34:29 +00:00
|
|
|
<hr><p align="center">Copyright © 2001-2002 Apache Software Foundation.
|
|
|
|
All rights Reserved.</p>
|
2001-02-13 12:32:01 +00:00
|
|
|
|
|
|
|
</body>
|
|
|
|
</html>
|
|
|
|
|