ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rebhan, Gilbert" <>
Subject RE: Using foreach
Date Wed, 24 Jun 2009 15:05:14 GMT

-----Original Message-----
From: Matt Benson [] 
Sent: Wednesday, June 24, 2009 2:57 PM
To: Ant Users List
Subject: RE: Using foreach


Not to rain on the proverbial parade, but you don't need iteration or third-party tasks to
do this:

<pathconvert pathsep="${line.separator}">
  <fileset dir="C:/test" includes="*.txt" />
  <flattenmapper />


P.S. You also didn't need to wrap your fileset in a path on your iteration-based example.


sure, works also with <pathconvert> and flattenmapper, would be better
in this case, but he already used antcontrib in his example, so  ...
yes, <path> is redundant,  it was a quick copy paste
of antcontrib manual, so the antcontrib manual has to be fixed.

btw, just noticed i completely ignored the fact that the poster used <foreach>,
so var and unset is not needed, as foreach opens a new project scope for every loop =

<target name="start">
  <foreach target="printOut" param="Files"> 
    <fileset dir="C:/test" casesensitive="no" />

<target name="printOut">
  <basename file="${Files}" property="basename"/>
  <echo message="${basename}"/>

Regards, Gilbert
To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message