1 | <html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Chapter 12. FileUtils</title><meta name="generator" content="DocBook XSL Stylesheets V1.68.1"><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="Chapter 11. Limit"><link rel="next" href="bk03ch13.html" title="Chapter 13. 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">Chapter 12. 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>Chapter 12. FileUtils</h2></div></div></div>
|
---|
2 | <STYLE TYPE="text/css"> <!-- @import url(./style.css); --> </STYLE>
|
---|
3 | <p>
|
---|
4 | 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>
|
---|
5 | </p><p>
|
---|
6 | To use this task in your build files, include a task definition like this:
|
---|
7 | </p><p>
|
---|
8 | </p><pre class="programlisting">
|
---|
9 |
|
---|
10 | <taskdef name="fileutil" classname="ise.antelope.tasks.FileUtilTask"/>
|
---|
11 |
|
---|
12 | </pre><p>
|
---|
13 | </p><p>
|
---|
14 | </p><div class="table"><a name="id2521773"></a><p class="title"><b>Table 12.1. FileUtil Task Attributes</b></p><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><p>
|
---|
15 | </p><p>
|
---|
16 | Operations as nested elements:
|
---|
17 | </p><p>
|
---|
18 | <span class="bold"><strong>listfiles</strong></span> Create a list of files and/or directories.
|
---|
19 | </p><div class="table"><a name="id2521860"></a><p class="title"><b>Table 12.2. listfiles</b></p><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><p>
|
---|
20 | </p><p>
|
---|
21 | <span class="bold"><strong>lastmodified</strong></span> Get the "last modified" date/timestamp of a file.
|
---|
22 |
|
---|
23 | </p><div class="table"><a name="id2521961"></a><p class="title"><b>Table 12.3. lastmodified</b></p><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><p>
|
---|
24 |
|
---|
25 | </p><p>
|
---|
26 | These operations have no attributes:
|
---|
27 | </p><div class="itemizedlist"><ul type="disc"><li><p>
|
---|
28 | <span class="bold"><strong>canread</strong></span> Is the file readable?
|
---|
29 | </p></li><li><p>
|
---|
30 | <span class="bold"><strong>canwrite</strong></span> Is the file writable?
|
---|
31 | </p></li><li><p>
|
---|
32 | <span class="bold"><strong>length</strong></span> Finds the length of the file.
|
---|
33 | </p></li><li><p>
|
---|
34 | <span class="bold"><strong>filecount</strong></span> Find the number of files in the directory.
|
---|
35 | </p></li><li><p>
|
---|
36 | <span class="bold"><strong>isdirectory</strong></span> Is the file a directory?
|
---|
37 | </p></li><li><p>
|
---|
38 | <span class="bold"><strong>isfile</strong></span> Is the file a file?
|
---|
39 | </p></li></ul></div><p>
|
---|
40 |
|
---|
41 | </p><p>
|
---|
42 | Only one of the operations can be used at once.
|
---|
43 | </p><p>
|
---|
44 | Examples: See the <a href="bk03ch23.html" title="Chapter 23. Split Task">Split</a> for several examples.
|
---|
45 | </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">Chapter 11. Limit </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 13. StringUtils</td></tr></table></div></body></html>
|
---|