I have a solution with <apply>. Echo the name to a new file.

<project name="directoryListing" default="main" basedir=".">
    <target name="main">

        <echo>
          Lists the the fileset
        </echo>
        <apply executable="cmd.exe" append="true">
            <arg line="/C echo" />
            <fileset dir=".">
                <include name="*.java" />
            </fileset>
        </apply>

        <echo>
          Store the fileset in a text file and show it
        </echo>
        <property name="out" value="dir.out" />
        <delete file="${out}" />
        <apply executable="cmd.exe" append="true" output="${out}">
            <arg line="/C echo" />
            <fileset dir=".">
                <include name="*.java" />
            </fileset>
        </apply>
        <loadfile property="listing" srcFile="${out}"/>
        <echo message="${listing}" />
    </target>
</project>

With some *.txt and some *.java files in my directory the output is:
C:\tmp\anttests\dirListing>ant
Ant-Home:  c:\seu\ant16
Java-Home: c:\seu\jdk14
Buildfile: build.xml

main:
     [echo]
     [echo]           Lists the the fileset
     [echo]
    [apply] C:\tmp\anttests\dirListing\a.java
    [apply] C:\tmp\anttests\dirListing\b.java
    [apply] C:\tmp\anttests\dirListing\c.java
     [echo]
     [echo]           Store the fileset in a text file and show it
     [echo]
     [echo] C:\tmp\anttests\dirListing\a.java
     [echo] C:\tmp\anttests\dirListing\b.java
     [echo] C:\tmp\anttests\dirListing\c.java

BUILD SUCCESSFUL
Total time: 1 second


So I recommend the second solution. :-)


Jan Mat�rne

-----Urspr�ngliche Nachricht-----
Von: Benoit Voisin [mailto:[EMAIL PROTECTED]]
Gesendet am: Donnerstag, 19. Dezember 2002 16:47
An: 'Ant Users List'
Betreff: Having a file list

Hi all,

I am willing to have a list of files contains in a fileset, basically like a
dir/s will do under windows.
Does anyone know about such a task. It should be too hard to implement, but
if it already exists...

Thanks,
Benoit

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to