Display or set a property containing the size of a nested Resource Collection. Can also be used as a condition. Since Apache Ant 1.7


Attribute Description Required
property The property to set. If omitted the results are written to the log. Ignored when processing as a condition. No
refid A reference to a Resource Collection. Yes, unless a nested Resource Collection is supplied
count Comparison count for processing as a condition. Yes, in condition mode
when Comparison type: "equal", "eq", "greater", "gt", "less", "lt", "ge" (greater or equal), "ne" (not equal), "le" (less or equal) for use when operating as a condition. No; default is "equal"

Parameters specified as nested elements

Resource Collection

A single Resource Collection should be specified via a nested element or the refid attribute.


<resourcecount property="">
  <filelist dir="." files="foo,bar" />

Stores the number of resources in the specified filelist (two) in the property named

  <property name="file" value="${ant.file}"/>
  <resourcecount property="file.lines">
        <fileset file="${file}"/>
  <echo>The file '${file}' has ${file.lines} lines.</echo>

Stores the number of lines of the current buildfile in the property file.lines. Requires Ant 1.7.1+ as <concat> has to be resource.