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 />
</pathconvert>

HTH,
Matt

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

--- On Wed, 6/24/09, nisse <[email protected]> wrote:

> From: nisse <[email protected]>
> Subject: RE: Using foreach
> To: [email protected]
> Date: Wednesday, June 24, 2009, 2:46 AM
> 
> Thanks! Works great!
> 
> 
> 
> Rebhan, Gilbert wrote:
> > 
> > 
> > -----Original Message-----
> > From: nisse [mailto:[email protected]]
> 
> > Sent: Wednesday, June 24, 2009 9:21 AM
> > To: [email protected]
> > Subject: Using foreach
> > 
> > /*
> > 
> > [..]
> > 
> > 
> > This code prints for example "C:/Temp/MyFile.txt"
> > But I only want it to print "MyFile.txt", how do I do
> that in a simple
> > way??
> > 
> > */
> > 
> > use <basename>, example
> > 
> > <for param="file">
> >  <path>
> >   <fileset dir="C:/test"
> includes="*.txt"/>
> >  </path>
> > <sequential>
> >  <var name="basename" unset="true"/>
> >  <basename file="@{file}"
> property="basename"/>
> >  <var name="filenames"
> value="${filenames},${basename}"/>
> > </sequential>
> > </for>
> > 
> > 
> > Regards, Gilbert
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [email protected]
> > For additional commands, e-mail: [email protected]
> > 
> > 
> > 
> 
> -- 
> View this message in context: 
> http://www.nabble.com/Using-foreach-tp24179911p24180173.html
> Sent from the Ant - Users mailing list archive at
> Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
> 
> 

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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to