-----Original Message-----
From: cvsusr [mailto:sp...@rediffmail.com] 
Sent: Thursday, October 29, 2009 3:34 PM
To: user@ant.apache.org
Subject: Re: Alternative for <available> taks to check a pattern of file 
existence

/*
<target name="check-abc">
<for param="file">
  <path>
    <fileset id="file.exist" dir="." includes="*.txt"/>
  </path>
<sequential>
<echo> file list::: @{file} </echo>
<available file="@{file}" property="abc.present"/>
</sequential>
</for>
</target>
*/

using for - which requires antcontrib also - when all you want
to know is whether there are any files with a specific extension
or name is redundant; all you need is a fileset and a condition

<fileset dir="your/path" includes="**/*.txt" id="checkdir"/>

<target name="check-abc">
<condition property="abc-present">
  <not>
    <equals arg1="${toString:checkdir}" arg2="" />
  </not>
</condition>
</target>

<target name="do-if-abc" depends="check-abc" if="abc.present">
<echo> true</echo>
</target>


Regards, Gilbert
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@ant.apache.org
For additional commands, e-mail: user-h...@ant.apache.org

Reply via email to