I have a completed set of files, and I need to print the corresponding file names into a text file.
I tried this:
<fileset id="myfileset" dir="../sounds"> <include name="*.wav" /> <include name="*.ogg" /> </fileset> <property name="sounds" refid="myfileset" /> <echo file="sounds.txt">${sounds}</echo>
which prints all files on one line, separated by semicolons. I need to have one file per line. How can I do this without resorting to calling OS commands or writing Java code?
UPDATE
Ah, it should have been more specific - the list should not contain directories. I still mark ChssPly76 as an accepted answer, since the pathconvert command was exactly what I was missing. To split directories and list only file names, I used the "flatten" mapper .
Here is the script I ended up with:
<fileset id="sounds_fileset" dir="../sound"> <include name="*.wav" /> <include name="*.ogg" /> </fileset> <pathconvert pathsep="
" property="sounds" refid="sounds_fileset"> <mapper type="flatten" /> </pathconvert> <echo file="sounds.txt">${sounds}</echo>
ant fileset
Tomas Andrle Sep 21 '09 at 21:05 2009-09-21 21:05
source share