Click here to Skip to main content
15,905,914 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Can i iterate over one directory level in ant??
I mean to say
Java
*DIR
     -->dir1
       ---->file1
       ---->file2
       ---->file3
     -->dir2
       ---->file1
       ---->file2
       ---->file3
     -->dir3
       ---->file1

What i want is dir1 dir2 dir3 ??

HTML
<!-- Script -->
<target name="forloop">
    <ac:foreach target="trimmer" param="file" xmlns:ac="#unknown">
        <path>
            <fileset dir="${directory}/SourceFolder/" includes="**/*">
                <depth max="1" />
            </fileset>
        </path>
    </ac:foreach>
</target>

<target name="trimmer">
    <echo message="${file}" />
</target>


But this gives me first level files not first level directories.
How can i improve it ??
Posted
Updated 16-Nov-11 19:17pm
v2
Comments
TorstenH. 17-Nov-11 1:20am    
what are you trying to do? why would you want to only touch the folders?
Anshul4u 17-Nov-11 2:02am    
try divide subdirectories in sublist say 3 each and perform parallel copy on each list using ant

1 solution

Instead of using a fileset for your code why don't you use the dirset, according to the ant-contrib documentation this should return directories.

So your for loop would look something like:
<ac:foreach target="trimmer" param="file" xmlns:ac="#unknown">
    <path>
        <dirset dir="="${directory}/SourceFolder/"" includes="*" />
    </path>
</ac:foreach>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900