source: release-kits/lirk3/bin/ant-installer/web/manual1.6.2/manual/CoreTasks/delete.html@ 14982

Last change on this file since 14982 was 14982, checked in by oranfry, 16 years ago

initial import of LiRK3

File size: 6.7 KB
Line 
1<html>
2
3<head>
4<meta http-equiv="Content-Language" content="en-us">
5<title>Delete Task</title>
6<link rel="stylesheet" type="text/css" href="../stylesheets/antmanual.css">
7</head>
8
9<body>
10
11<h2><a name="delete">Delete</a></h2>
12<h3>Description</h3>
13<p>Deletes a single file, a specified directory and all its files and
14subdirectories, or a set of files specified by one or more
15<a href="../CoreTypes/fileset.html">FileSet</a>s.
16When specifying a set of files, empty directories are <i>not</i> removed by
17default.
18To remove empty directories, use the <code>includeEmptyDirs</code> attribute.
19</p>
20<p>
21If you use this task to delete temporary files created by editors
22and it doesn't seem to work, read up on the
23<a href="../dirtasks.html#defaultexcludes">default exclusion set</a>
24in <strong>Directory-based Tasks</strong>, and see the
25<code>defaultexcludes</code> attribute below.
26
27<h3>Parameters</h3>
28<table border="1" cellpadding="2" cellspacing="0">
29 <tr>
30 <td valign="top"><b>Attribute</b></td>
31 <td valign="top"><b>Description</b></td>
32 <td align="center" valign="top"><b>Required</b></td>
33 </tr>
34 <tr>
35 <td valign="top">file</td>
36 <td valign="top">The file to delete, specified as either the simple
37 filename (if the file exists in the current base directory), a
38 relative-path filename, or a full-path filename.</td>
39 <td align="center" valign="middle" rowspan="2">At least one of the two,
40 unless a <code>&lt;fileset&gt;</code> is specified.</td>
41 </tr>
42 <tr>
43 <td valign="top">dir</td>
44 <td valign="top">The directory to delete, including all its files and
45 subdirectories.<br>
46 <b>Note:</b> <code>dir</code> is <em>not</em> used
47 to specify a directory name for <code>file</code>; <code>file</code>
48 and <code>dir</code> are independent of each other.<br>
49 <b>WARNING:</b> Do <b>not</b> set <code>dir</code> to
50 <code>&quot;.&quot;</code>, <code>&quot;${basedir}&quot;</code>,
51 or the full-pathname equivalent unless you truly <em>intend</em> to
52 recursively remove the entire contents of the current base directory
53 (and the base directory itself, if different from the current working
54 directory).</td>
55 </tr>
56 <tr>
57 <td valign="top">verbose</td>
58 <td valign="top">Show the name of each deleted file
59 (&quot;true&quot;/&quot;false&quot;).
60 Default is &quot;false&quot; when omitted.</td>
61 <td align="center" valign="top">No</td>
62 </tr>
63 <tr>
64 <td valign="top">quiet</td>
65 <td valign="top">If the specified file or directory does not exist,
66 do not display a diagnostic message (unless Ant
67 has been invoked with the <code>&#x2011;verbose</code> or
68 <code>&#x2011;debug</code> switches) or modify the exit status to
69 reflect an error.
70 When set to &quot;true&quot;, if a file or directory cannot be deleted,
71 no error is reported. This setting emulates the
72 <code>-f</code> option to the Unix <em>rm</em> command.
73 Default is &quot;false&quot;.
74 Setting this to &quot;true&quot; implies setting
75 <code>failonerror</code> to &quot;false&quot;.
76 </td>
77 <td align="center" valign="top">No</td>
78 </tr>
79 <tr>
80 <td valign="top">failonerror</td>
81 <td valign="top">
82 Controls whether an error (such as a failure to delete a file)
83 stops the build or is merely reported to the screen.
84 Only relevant if <code>quiet</code> is &quot;false&quot;.
85 Default is &quot;true&quot;.
86 </td>
87 <td align="center" valign="top">No</td>
88 </tr>
89 <tr>
90 <td valign="top">includeEmptyDirs</td>
91 <td valign="top">Set to &quot;true&quot; to delete empty directories when
92 using filesets. Default is &quot;false&quot;.</td>
93 <td align="center" valign="top">No</td>
94 </tr>
95 <tr>
96 <td valign="top">includes</td>
97 <td valign="top"><em>Deprecated.</em> Use <code>&lt;fileset&gt;</code>.
98 Comma- or space-separated list of patterns of
99 files that must be deleted. All files are relative to the directory
100 specified in <code>dir</code>.
101 </td>
102 <td valign="top" align="center">No</td>
103 </tr>
104 <tr>
105 <td valign="top">includesfile</td>
106 <td valign="top"><em>Deprecated.</em> Use <code>&lt;fileset&gt;</code>.
107 The name of a file. Each line of
108 this file is taken to be an include pattern</td>
109 <td valign="top" align="center">No</td>
110 </tr>
111 <tr>
112 <td valign="top">excludes</td>
113 <td valign="top"><em>Deprecated.</em> Use <code>&lt;fileset&gt;</code>.
114 Comma- or space-separated list of patterns of
115 files that must be excluded from the deletion list.
116 All files are relative to the directory specified in <code>dir</code>.
117 No files (except default excludes) are excluded when omitted.</td>
118 <td valign="top" align="center">No</td>
119 </tr>
120 <tr>
121 <td valign="top">excludesfile</td>
122 <td valign="top"><em>Deprecated.</em> Use <code>&lt;fileset&gt;</code>.
123 The name of a file. Each line of
124 this file is taken to be an exclude pattern</td>
125 <td valign="top" align="center">No</td>
126 </tr>
127 <tr>
128 <td valign="top">defaultexcludes</td>
129 <td valign="top"> Indicates whether default excludes
130 should be used or not (&quot;yes&quot;/&quot;no&quot;).
131 Default excludes are used when omitted.</td>
132 <td valign="top" align="center">No</td>
133 </tr>
134 <tr>
135 <td valign="top">deleteonexit</td>
136 <td valign="top">
137 Indicates whether to use File#deleteOnExit() if there is a
138 failure to delete a file, this causes the jvm to attempt
139 to delete the file when the jvm process is terminating.
140 The default is false.
141 <em>Since Ant 1.6.2</em>
142 <td valign="top" align="center">No</td>
143 </tr>
144</table>
145<h3>Examples</h3>
146<pre> &lt;delete file=&quot;/lib/ant.jar&quot;/&gt;</pre>
147<p>deletes the file <code>/lib/ant.jar</code>.</p>
148<pre> &lt;delete dir=&quot;lib&quot;/&gt;</pre>
149<p>deletes the <code>lib</code> directory, including all files
150and subdirectories of <code>lib</code>.</p>
151<pre> &lt;delete&gt;
152 &lt;fileset dir=&quot;.&quot; includes=&quot;**/*.bak&quot;/&gt;
153 &lt;/delete&gt;
154</pre>
155<p>deletes all files with the extension <code>.bak</code> from the current directory
156and any subdirectories.</p>
157<pre> &lt;delete includeEmptyDirs=&quot;true&quot;&gt;
158 &lt;fileset dir=&quot;build&quot;/&gt;
159 &lt;/delete&gt;
160</pre>
161<p>deletes all files and subdirectories of <code>build</code>, including
162<code>build</code> itself.</p>
163<pre> &lt;delete includeemptydirs=&quot;true&quot;&gt;
164 &lt;fileset dir=&quot;build&quot; includes=&quot;**/*&quot;/&gt;
165 &lt;/delete&gt;
166</pre>
167<p>deletes all files and subdirectories of <code>build</code>, without
168<code>build</code> itself.</p>
169<hr><p align="center">Copyright &copy; 2000-2002,2004 The Apache Software Foundation.
170All rights Reserved.</p>
171
172</body>
173</html>
174
Note: See TracBrowser for help on using the repository browser.