The FileUtils task provides a number of useful file information functions, such as readability, writability, length, etc. Caution: this task does not follow the standard Ant convention of property immutability.
To use this task in your build files, include a task definition like this:
<taskdef name="fileutil" classname="ise.antelope.tasks.FileUtilTask"/>
Table 12.1. FileUtil Task Attributes
|file||The file or directory in question.||None||No, but does nothing without a file.|
|property||Where to store the answer. Caution: this task will overwrite any existing property with this name.||None||No|
Operations as nested elements:
listfiles Create a list of files and/or directories.
Table 12.2. listfiles
|what||What to list, valid values are "files", "dirs", or "all".||files||No|
|separator||The separator to use between individual items in the list of files.||, (comma)||No|
|includepath||If true, include the path with the names in the list. If false, include only the names.||true||No|
lastmodified Get the "last modified" date/timestamp of a file.
Table 12.3. lastmodified
|format||A format for the last modified timestamp. Must comply with the standards listed in java.text.SimpleDateFormat.||No|
These operations have no attributes:
canread Is the file readable?
canwrite Is the file writable?
length Finds the length of the file.
filecount Find the number of files in the directory.
isdirectory Is the file a directory?
isfile Is the file a file?
Only one of the operations can be used at once.
Examples: See the Split for several examples.