File: bk03ch12.html

package info (click to toggle)
antelope 3.5.1-5
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, sid, trixie
  • size: 3,884 kB
  • sloc: java: 27,651; xml: 6,488; sh: 12; makefile: 5
file content (45 lines) | stat: -rw-r--r-- 5,295 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Chapter12.FileUtils</title><meta name="generator" content="DocBook XSL Stylesheets V1.73.2"><link rel="start" href="index.html" title="Antelope Users Guide"><link rel="up" href="bk03.html" title="Additional Ant Tasks"><link rel="prev" href="bk03ch11.html" title="Chapter11.Limit"><link rel="next" href="bk03ch13.html" title="Chapter13.StringUtils"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter12.FileUtils</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="bk03ch11.html">Prev</a></td><th width="60%" align="center">Additional Ant Tasks</th><td width="20%" align="right"><a accesskey="n" href="bk03ch13.html">Next</a></td></tr></table><hr></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="FileUtils"></a>Chapter12.FileUtils</h2></div></div></div>
<STYLE TYPE="text/css"> <!-- @import url(./style.css); --> </STYLE>
   <p>
The FileUtils task provides a number of useful file information functions, such as readability, writability, length, etc.  <span class="bold"><strong>Caution: this task does not follow the standard Ant convention of property immutability.</strong></span>
</p><p>
To use this task in your build files, include a task definition like this:
</p><p>
</p><pre class="programlisting">

    &lt;taskdef name="fileutil" classname="ise.antelope.tasks.FileUtilTask"/&gt;
   
</pre><p>
</p><p>
</p><div class="table"><a name="id2551079"></a><p class="title"><b>Table12.1.FileUtil Task Attributes</b></p><div class="table-contents"><table summary="FileUtil Task Attributes" border="1"><colgroup><col><col><col><col></colgroup><thead><tr><th>Attribute</th><th>Description</th><th>Default</th><th>Required</th></tr></thead><tbody><tr><td>file</td><td>The file or directory in question.</td><td>None</td><td>No, but does nothing without a file.</td></tr><tr><td>property</td><td>Where to store the answer. Caution: this task will overwrite any existing property with this name.</td><td>None</td><td>No</td></tr></tbody></table></div></div><p><br class="table-break">
</p><p>
Operations as nested elements:
</p><p>
<span class="bold"><strong>listfiles</strong></span> Create a list of files and/or directories.
</p><div class="table"><a name="id2551162"></a><p class="title"><b>Table12.2.listfiles</b></p><div class="table-contents"><table summary="listfiles" border="1"><colgroup><col><col><col><col></colgroup><thead><tr><th>Attribute</th><th>Description</th><th>Default</th><th>Required</th></tr></thead><tbody><tr><td>what</td><td>What to list, valid values are "files", "dirs", or "all".</td><td>files</td><td>No</td></tr><tr><td>separator</td><td>The separator to use between individual items in the list of files.</td><td>, (comma)</td><td>No</td></tr><tr><td>includepath</td><td>If true, include the path with the names in the list.  If false, include only the names.</td><td>true</td><td>No</td></tr></tbody></table></div></div><p><br class="table-break">
</p><p>
<span class="bold"><strong>lastmodified</strong></span> Get the "last modified" date/timestamp of a file.

</p><div class="table"><a name="id2551259"></a><p class="title"><b>Table12.3.lastmodified</b></p><div class="table-contents"><table summary="lastmodified" border="1"><colgroup><col><col><col><col></colgroup><thead><tr><th>Attribute</th><th>Description</th><th>Default</th><th>Required</th></tr></thead><tbody><tr><td>format</td><td>A format for the last modified timestamp.  Must comply with the standards listed in java.text.SimpleDateFormat.</td><td></td><td>No</td></tr></tbody></table></div></div><p><br class="table-break">

</p><p>
These operations have no attributes:
</p><div class="itemizedlist"><ul type="disc"><li><p>
<span class="bold"><strong>canread</strong></span> Is the file readable?
</p></li><li><p>
<span class="bold"><strong>canwrite</strong></span> Is the file writable?
</p></li><li><p>
<span class="bold"><strong>length</strong></span> Finds the length of the file.
</p></li><li><p>
<span class="bold"><strong>filecount</strong></span> Find the number of files in the directory.
</p></li><li><p>
<span class="bold"><strong>isdirectory</strong></span> Is the file a directory?
</p></li><li><p>
<span class="bold"><strong>isfile</strong></span> Is the file a file?
</p></li></ul></div><p>

</p><p>
Only one of the operations can be used at once.
</p><p>
Examples: See the <a class="link" href="bk03ch23.html" title="Chapter23.Split Task">Split</a> for several examples.
</p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="bk03ch11.html">Prev</a></td><td width="20%" align="center"><a accesskey="u" href="bk03.html">Up</a></td><td width="40%" align="right"><a accesskey="n" href="bk03ch13.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter11.Limit</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">Chapter13.StringUtils</td></tr></table></div></body></html>