For easy display I had made a short project some time ago:

<project name="directoryListing" default="main" basedir=".">
    <target name="main">
        <fileset dir="." id="files.fs">
            <include name="**/*.java" />
        </fileset>

        <echo>All in one row:</echo>
          <echo/>

        <pathconvert pathsep=";" property="files.prop" refid="files.fs"/>
        <echo>${files.prop}</echo>

        <echo/>
        <echo>In multiple lines:</echo>
        <echo/>

        <pathconvert pathsep="${line.separator}" property="files.prop2"
refid="files.fs"/>
        <echo>${files.prop2}</echo>
    </target>
</project>


With a given directory structure

C:\tmp\anttests\dirListing
|   a.java
|   a.txt
|   b.java
|   b.txt
|   build.xml
|   c.java
|   c.txt
|   d.txt
|   tree.txt
|   
\---subdir
        c.java
        c.txt
        
it gave me

main:
     [echo] All in one row:

     [echo]
C:\tmp\anttests\dirListing\a.java;C:\tmp\anttests\dirListing\b.java;C:\tmp\a
nttests\dirListing\c.java;C:\tmp\anttests\
dirListing\subdir\c.java
     [echo] In multiple rows:

     [echo] C:\tmp\anttests\dirListing\a.java
     [echo] C:\tmp\anttests\dirListing\b.java
     [echo] C:\tmp\anttests\dirListing\c.java
     [echo] C:\tmp\anttests\dirListing\subdir\c.java

BUILD SUCCESSFUL
Total time: 1 second


The whole directory structure is stored in the two properties.


Jan

> -----Ursprüngliche Nachricht-----
> Von: Dibi, George [mailto:[EMAIL PROTECTED]
> Gesendet am: Montag, 5. Mai 2003 22:31
> An: '[EMAIL PROTECTED]'
> Betreff: list a content of a directory
> 
> I am trying to display a directory content. Please see attach 
> for trace out.
> Does any body know what I should do? Thanks
>  
> <project name="NATE" default="build" basedir=".">
>         <property name="temp_copy" 
> location="\\eappd55\public\gdibi\etc"/>
>         <target name="build">
>             <copy todir="${temp_copy}/src">
>                  <fileset dir="src">
>                    <include name="**/*.*"/>
>                  </fileset>
>             </copy>
>             <apply executable="dir">
>                <arg value="/w"/>
>                <fileset dir="c:\Ant\bin\src">
>                  <patternset>
>                   <exclude name="**/*.sig"/>
>                  </patternset>
>                </fileset>
>                 </apply>
>         </target>
>         </project>
>  
>  
> TI- Navigator Deployment
> O. (972) 917-3528
> Email. [EMAIL PROTECTED]
>  
> 

Reply via email to