tags:

views:

248

answers:

1

Hi there,

I'm working with Ant 1.6 and cannot use a "resourcecount" within a "condition". Basically, I'd like to check if a FileSet contains elements according to regex:

<condition property="foo.exist">
   <resourcecount when="greater" count="0">
     <filelist dir="." files="*foo*" />
   </resourcecount>
</condition>

Normally this would assign the property foo.exist if the current directory contains the pattern "foo" inside the names. But I cannot do that within ant 1.6.

Do you have any idea?

//UPDATE

I just saw that in fact I couldnt use ResourceCount with ant 1.6... http://ant.apache.org/manual/CoreTasks/conditions.html

A: 
 <path id="a">
    <fileset dir=".">
     <include name="*foo*"/>
    </fileset>
 </path>

 <property name="foo.exist" refid="a"/>

 <echo>${foo.exist}</echo>
FoxyBOA
Great it works. Thanks a lot!