Hello,
I got interested and I wrote a sample build script,
following Matt's instructions:
<project>
<fileset dir="${basedir}" id="xml.files">
<include name="*.xml"/>
</fileset>
<pathconvert pathsep="" refid="xml.files"
setonempty="true"
property="aaa.xml.files">
<mergemapper to="a"/>
</pathconvert>
<echo>${aaa.xml.files}</echo>
<length property="count.xml.files"
string="${aaa.xml.files}"/>
<echo>${count.xml.files}</echo>
</project>
Regards
Ivan
--- Matt Benson <[EMAIL PROTECTED]> wrote:
> --- Rick Genter <[EMAIL PROTECTED]> wrote:
>
> > Fellow ant-users,
> >
> > Is there a way using only core tasks in ant 1.6.5
> to
> > count the number of
> > files in a fileset? I've been through the manual
> and
> > nothing leapt out
> > at me. Thanks.
>
> Hi Rick. In Ant 1.7 you will be able to use the
> <resourcecount> task/condition. For now, in Ant
> 1.6.5, I'm afraid there is no solution... just
> kidding; actually here is a trick you can use. >;)
>
> Use <pathconvert> to convert your filelist to a
> property. Use a merge mapper to call each file "*"
> or
> whatever. Set whatever the attribute is that makes
> pathconvert still create the property even if the
> result is empty (setonempty="true"?). Now use the
> <length> task/condition (available in Ant >= 1.6.3
> IIRC), against your newly-<pathconvert>ed property.
>
> HTH,
> Matt
>
> >
> > Rick
> > --
> > Rick Genter
> > Principal Engineer
> > Silverlink Communications
> > <mailto:[EMAIL PROTECTED]>
> > (781) 425-5763
> >
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > [EMAIL PROTECTED]
> > For additional commands, e-mail:
> > [EMAIL PROTECTED]
> >
> >
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam
> protection around
> http://mail.yahoo.com
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
>
>
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]