title: Finding and using the latest modified FOLDER/Directory using ant
body: <p>So the current solution I have finds the latest modified FILE inside all of the folders. I need a way to get the latest modified folder. The reason being, a folder will get created on a daily basis, and I will need to use that folder value in a file path so that I can copy the contents of that path in another directory.</p>
  
  <p>The code I have is as follows:</p>
  
  <pre><code>&lt;target name = "latest"&gt;
   &lt;copy todir = "H:\New"&gt;
    &lt;last&gt;
     &lt;sort&gt;
      &lt;date xmlns="antlib:org.apache.tools.ant.types.resources.comparators"/&gt;
      &lt;filseset dir ="H:\test"/&gt;
     &lt;/sort&gt;
    &lt;/last&gt;
   &lt;/copy&gt;
  &lt;/target&gt;
  
  Folder Overview
  Main
  |---Folder2(16/01/15)
  |---Folder1(28/01/15)
  </code></pre>
  
  <p>The program needs to select Folder1 (overall idea).</p>
  
  <p>I.E. of file path: C:/A/${latest.modified&lt;}/etc/files</p>