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/15 17:40:44 UTC
RE: Counting files from within ant - Solved
Thanks everyone, that did the job nicely. For reference here is the full
target:
<!-- Integrity Check to count all files fetched and no. it should of fetched
-->
<target name="integrity_check">
<exec executable="c:\usr\bin\find"
outputproperty="num_files_vss_fetched">
<arg line="${local_release_files} -type f | wc -l | sed
's/^[ \t]*//;s/[ \t]*$//'"/>
</exec>
<echo message="Files fetched from VSS : ${num_files_vss_fetched}"/>
<echo message="Files should be fetched:
${num_files_vss_should_fetch}"/>
<condition property="num_files_vss_fetched_OK">
<equals arg1="${num_files_vss_fetched}"
arg2="${num_files_vss_should_fetch}" />
</condition>
<echo message="Compare result : ${num_files_vss_fetched_OK}"/>
</target>
-----Original Message-----
From: Jason Rogers [mailto:jason.rogers@tumbleweed.com]
Sent: 15 October 2001 14:19
To: 'ant-user@jakarta.apache.org'
Subject: RE: Counting files from within ant
Use cygwin... freely available, powerful, a real bonus to the Windows
platform.
http://sources.redhat.com/cygwin/
-----------------------------------
Jason Rogers
Tumbleweed Communications
Ann Arbor, MI
[mailto:jason.rogers@tumbleweed.com]
-- Keep it simple
(1 Corinthians 2:2, Galatians 2:20)
> -----Original Message-----
> From: Euan Guttridge [mailto:EGuttridge@buildonline.com]
> Sent: Monday, October 15, 2001 9:20 AM
> To: 'ant-user@jakarta.apache.org'
> Subject: RE: Counting files from within ant
>
>
> Hi,
>
> Unfortunately I need to run the script on NT. Any other
> suggestions?
>
>
> --- 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
>
>