title: batch file to get file from last modified folder
body: <p>I have a batch file that compares two files and uses xcopy to copy the file if the time stamp is different. So it goes something like this:</p>
  
  <pre><code>set sourcefiletime=
  for %%X in (%Source%) do set sourcefiletime=%%~tX
  set targetfiletime=
  for %%X in (%Local%) do set targetfiletime=%%~tX
  if "%sourcefiletime%" == "%targetfiletime%" goto noUpdate
  xcopy...
  </code></pre>
  
  <p>The trouble I have now is that the folder structure has changed from always being a constant folder name to having different names based on date and time. And there may be multiple folders.</p>
  
  <p>e.g. </p>
  
  <pre><code>"Build_20160411_105904"
  "Build_20160410_155605"
  "Build_20160410_021104"
  ...
  </code></pre>
  
  <p>Is there any way I can get my batch file to check the "last modified" folder and grab the file from there? If it helps, the file I need will always have the same name, so can I check the parent folder's directories for the last modified file instead?</p>
  
  <p>Apologies if something similar has been asked before.</p>