ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan.Mate...@rzf.fin-nrw.de
Subject AW: Having a file list
Date Thu, 19 Dec 2002 16:10:30 GMT
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:benoit.voisin@ergoidp.dk]
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:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message