« Return to Thread: Using foreach

Using foreach

by nisse :: Rate this Message:

Reply to Author | View in Thread

Hi

I'm trying get all files from a directory and print it to the screen. And I only want to print the name of the file, not with the path and filename. My code looks like this:

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

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


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??

Very grateful for any help!

 « Return to Thread: Using foreach