ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ivan \"Rambius\" Ivanov" <rambiusparkisan...@yahoo.com>
Subject Re: Task to count files in a fileset?
Date Sun, 26 Mar 2006 19:24:05 GMT
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 <gudnabrsam@yahoo.com> wrote:

> --- Rick Genter <rgenter@silverlink.com> 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:rgenter@silverlink.com>
> > (781) 425-5763
> > 
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > user-unsubscribe@ant.apache.org
> > For additional commands, e-mail:
> > user-help@ant.apache.org
> > 
> > 
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam
> protection around 
> http://mail.yahoo.com 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@ant.apache.org
> For additional commands, e-mail:
> user-help@ant.apache.org
> 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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


Mime
View raw message