You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Euan Guttridge <EG...@buildonline.com> on 2001/10/12 16:50:55 UTC

Counting files from within ant

Hi,

My ant script fetches a group of labelled files for release, but I would
then like to be able to **count recursively from a root directory the number
of files fetched** - and compare this with the number supposed to have been
fetched (as an integrity check), all within the ant script. Aside from using
Perl or Windows Scripting Host, can anyone think of an easy(er) method??

Thanks
EG.

Re: Counting files from within ant

Posted by Diane Holt <ho...@yahoo.com>.
--- Euan Guttridge <EG...@buildonline.com> wrote:
> My ant script fetches a group of labelled files for release, but I would
> then like to be able to **count recursively from a root directory the
> number of files fetched** - and compare this with the number supposed
> to have been fetched (as an integrity check), all within the ant script.
> Aside from using Perl or Windows Scripting Host, can anyone think of an
> easy(er) method??

How platform-independent do you need to be? If you're unix-only, you could
just <exec> a 'sh -c "find . -type f | wc -l"' with the "outputproperty"
attribute set, then use <condition> (assuming you're running 1.4) to
compare the value of your "integrity check" property with the
"outputproperty" property.

Diane  

=====
(holtdl@yahoo.com)



__________________________________________________
Do You Yahoo!?
Make a great connection at Yahoo! Personals.
http://personals.yahoo.com