source: release-kits/lirk3/resources/gs3-release-maker/ant/docs/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.6 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">Whether to show the name of each deleted file.</td>
59 <td align="center" valign="top">No, default &quot;false&quot;</i></td>
60 </tr>
61 <tr>
62 <td valign="top">quiet</td>
63 <td valign="top">If the specified file or directory does not exist,
64 do not display a diagnostic message (unless Ant
65 has been invoked with the <code>&#x2011;verbose</code> or
66 <code>&#x2011;debug</code> switches) or modify the exit status to
67 reflect an error.
68 When set to &quot;true&quot;, if a file or directory cannot be deleted,
69 no error is reported. This setting emulates the
70 <code>-f</code> option to the Unix <em>rm</em> command.
71 Setting this to &quot;true&quot; implies setting
72 <code>failonerror</code> to &quot;false&quot;.
73 </td>
74 <td align="center" valign="top">No, default &quot;false&quot;</td>
75 </tr>
76 <tr>
77 <td valign="top">failonerror</td>
78 <td valign="top">Controls whether an error (such as a failure to
79 delete a file) stops the build or is merely reported to the screen.
80 Only relevant if <code>quiet</code> is &quot;false&quot;.</td>
81 <td align="center" valign="top">No, default &quot;true&quot;</td>
82 </tr>
83 <tr>
84 <td valign="top">includeemptydirs</td>
85 <td valign="top">Whether to delete empty directories
86 when using filesets.</td>
87 <td align="center" valign="top">No, default &quot;false&quot;</td>
88 </tr>
89 <tr>
90 <td valign="top">includes</td>
91 <td valign="top"><em>Deprecated.</em> Use <code>&lt;fileset&gt;</code>.
92 Comma- or space-separated list of patterns of
93 files that must be deleted. All files are relative to the directory
94 specified in <code>dir</code>.</td>
95 <td valign="top" align="center">No</td>
96 </tr>
97 <tr>
98 <td valign="top">includesfile</td>
99 <td valign="top"><em>Deprecated.</em> Use <code>&lt;fileset&gt;</code>.
100 The name of a file. Each line of
101 this file is taken to be an include pattern.</td>
102 <td valign="top" align="center">No</td>
103 </tr>
104 <tr>
105 <td valign="top">excludes</td>
106 <td valign="top"><em>Deprecated.</em> Use <code>&lt;fileset&gt;</code>.
107 Comma- or space-separated list of patterns of
108 files that must be excluded from the deletion list.
109 All files are relative to the directory specified in <code>dir</code>.
110 No files (except default excludes) are excluded when omitted.</td>
111 <td valign="top" align="center">No</td>
112 </tr>
113 <tr>
114 <td valign="top">excludesfile</td>
115 <td valign="top"><em>Deprecated.</em> Use <code>&lt;fileset&gt;</code>.
116 The name of a file. Each line of
117 this file is taken to be an exclude pattern</td>
118 <td valign="top" align="center">No</td>
119 </tr>
120 <tr>
121 <td valign="top">defaultexcludes</td>
122 <td valign="top"><em>Deprecated.</em> Use <code>&lt;fileset&gt;</code>.
123 Whether to use <a href="../dirtasks.html#defaultexcludes">
124 default excludes.</a></td>
125 <td align="center" valign="top">No, default &quot;true&quot;</td>
126 </tr>
127 <tr>
128 <td valign="top">deleteonexit</td>
129 <td valign="top">
130 Indicates whether to use File#deleteOnExit() if there is a
131 failure to delete a file, this causes the jvm to attempt
132 to delete the file when the jvm process is terminating.
133 <em>Since Ant 1.6.2</em></td>
134 <td align="center" valign="top">No, default &quot;false&quot;.</td>
135 </tr>
136</table>
137<h3>Examples</h3>
138<pre> &lt;delete file=&quot;/lib/ant.jar&quot;/&gt;</pre>
139<p>deletes the file <code>/lib/ant.jar</code>.</p>
140<pre> &lt;delete dir=&quot;lib&quot;/&gt;</pre>
141<p>deletes the <code>lib</code> directory, including all files
142and subdirectories of <code>lib</code>.</p>
143<pre> &lt;delete&gt;
144 &lt;fileset dir=&quot;.&quot; includes=&quot;**/*.bak&quot;/&gt;
145 &lt;/delete&gt;
146</pre>
147<p>deletes all files with the extension <code>.bak</code> from the current directory
148and any subdirectories.</p>
149<pre> &lt;delete includeEmptyDirs=&quot;true&quot;&gt;
150 &lt;fileset dir=&quot;build&quot;/&gt;
151 &lt;/delete&gt;
152</pre>
153<p>deletes all files and subdirectories of <code>build</code>, including
154<code>build</code> itself.</p>
155<pre> &lt;delete includeemptydirs=&quot;true&quot;&gt;
156 &lt;fileset dir=&quot;build&quot; includes=&quot;**/*&quot;/&gt;
157 &lt;/delete&gt;
158</pre>
159<p>deletes all files and subdirectories of <code>build</code>, without
160<code>build</code> itself.</p>
161<hr><p align="center">Copyright &copy; 2000-2002,2004 The Apache Software Foundation.
162All rights Reserved.</p>
163
164</body>
165</html>
166
Note: See TracBrowser for help on using the repository browser.