ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dominique Devienne" <ddevie...@gmail.com>
Subject RE: Count number of files in fileset
Date Mon, 13 Jun 2005 19:48:47 GMT
> In 1.6 you could use the ${toString:} psuedo-property:
>   <target name="present">
>     <fileset id="fileset.notpresent" dir="."
>              includes="*.notpresent"/>
>     <condition property="no.files.present">
>       <equals arg1="" arg2="${toString:fileset.notpresent}"/>
>     </condition>
>     <echo>no.files.present=${no.files.present}</echo>
>     <fileset id="fileset.present" dir="."
>              includes="*.xml"/>
>     <condition property="no.files.present_2">
>       <equals arg1="" arg2="${toString:fileset.present}"/>
>     </condition>
>     <echo>no.files.present_2=${no.files.present_2}</echo>
>   </target>

You can check a fileset is empty using the above, but not count the number
of files. For that you'd need custom code, in Java or in a <script>.

Note that ${toString:referenceId} is still a bit experimental.

Using <property name="foo" refid="referenceId" /> is more traditional (but
Ant 1.6 specific), and for older versions of Ant, use <pathconvert> to
convert the fileset into a string. --DD


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message