Take the 2-minute tour ×  We want to loop through directory
structure in ant without using foreach . Is there any elegant
way to do the same ?  share|improve this question What are you
trying to do with the directory structure? If you're doing
something like building an ant project in each directory, you
may be able to get the functionality you want with subant – 
David Mar 6 '13 at 16:17 add comment  2 Answers  The apply task
can iterate over a set of directories or files  <target
name="run-apply">     <apply executable="echo">         <dirset
dir="src"/>  I personally like the groovy ANT task  <target
name="run-groovy">     <taskdef name="groovy"
classname="org.codehaus.groovy.ant.Groovy"/>     <dirset
id="dirs" dir="src"/>         project.references.dirs.each {
ant.echo it  The installation of the task jar is easily
automated:  <target name="install-groovy">   <mkdir
dir="${user.home}/.ant/lib"/>   <get
dest="${user.home}/.ant/lib/groovy-all.jar"
src="http://search.maven.org/remotecontent?filep