Display or set a property containing length information for a string, a file, or one or more nested filesets. Can also be used as a condition. Since Ant 1.6.3


Attribute Description Required
property The property to set. If omitted the results are written to the log. Ignored when processing as a condition. No
file Single file whose length to report. One of these, or one or more nested filesets
string The string whose length to report.
mode File length mode; when "all" the resulting value is the sum of all included files' lengths; when "each" the task outputs the absolute path and length of each included file, one per line. Ignored when processing as a condition. No; default is "all"
trim Whether to trim when operating on a string. No; only valid when string is set
length Comparison length for processing as a condition. Yes, in condition mode
when Comparison type: "equal", "greater", "less" for use when operating as a condition. No; default is "equal"

Parameters specified as nested elements


You can include files via nested filesets.


<length file="bar" property="length.bar" />
<length string="foo" property="length.foo" />

Stores the length of the string "foo" in the property named length.foo.

Stores the length of file "bar" in the property named length.bar.

Source: Apache Ant