title: Ant - iterate on a folder to get run arguments
body: <p>I have an ant script that compile my program, build the jar and then run it. My program takes one argument that is a file.</p>
  
  <p>In my run target I would like to be able to execute my jar with all the files that are in a specified folder, one by one, as argument.</p>
  
  <p>Do I have to write all the different cases by hand like:</p>
  
  <pre><code>&lt;target name="run" depends="jar"&gt;
       &lt;mkdir dir="${output.dir}" /&gt;
       &lt;java jar="${myjar}.jar" output="${output.dir}/${test1}" fork="true"&gt;
            &lt;arg value="${test.dir}/${test1}" /&gt;
       &lt;/java&gt;
       &lt;java jar="${myjar}.jar" output="${output.dir}/${test2}" fork="true"&gt;
            &lt;arg value="${test.dir}/${test2}" /&gt;
       &lt;/java&gt;
  
       #and so on
  
  &lt;/target&gt;
  </code></pre>
  
  <p>or is there a way to maybe <em>iterate</em> over my test directory and save me the writing of 20 other cases?</p>
  
  <p>Thanks.</p>