title: How can I print a fileset to a file, one file name per line?
body: <p>I have a populated fileset and I need to print the matching filenames into a text file.</p>
  
  <p>I tried this:</p>
  
  <pre><code>&lt;fileset id="myfileset" dir="../sounds"&gt;
      &lt;include name="*.wav" /&gt;
      &lt;include name="*.ogg" /&gt;
  &lt;/fileset&gt;
  
  &lt;property name="sounds" refid="myfileset" /&gt;
  &lt;echo file="sounds.txt"&gt;${sounds}&lt;/echo&gt;
  </code></pre>
  
  <p>which prints all the files on a single line, separated by semicolons. I need to have one file per line. How can I do this without resorting to calling OS commands or writing Java code?</p>
  
  <p><strong>UPDATE</strong>:</p>
  
  <p>Ah, should have been more specific - the list must not contain directories. I'm marking ChssPly76's as the accepted answer anyway, since the <a href="http://ant.apache.org/manual/Tasks/pathconvert.html" rel="noreferrer">pathconvert</a> command was exactly what I was missing. To strip the directories and list only the filenames, I used the <a href="http://ant.apache.org/manual/Types/mapper.html#flatten-mapper" rel="noreferrer">"flatten" mapper</a>.</p>
  
  <p>Here is the script that I ended up with:</p>
  
  <pre><code>&lt;fileset id="sounds_fileset" dir="../sound"&gt;
      &lt;include name="*.wav" /&gt;
      &lt;include name="*.ogg" /&gt;
  &lt;/fileset&gt;
  
  &lt;pathconvert pathsep="&amp;#xA;" property="sounds" refid="sounds_fileset"&gt;
      &lt;mapper type="flatten" /&gt;
  &lt;/pathconvert&gt;
  
  &lt;echo file="sounds.txt"&gt;${sounds}&lt;/echo&gt;
  </code></pre>