title: Bash Script to find the most recently modified file
body: <p>I have two folders, for arguments sake /Volumes/A and /Volumes/B. They are mounted network shares from a Windows server containing a load of .bkf files from Backup Exec.</p>
  
  <p>I am looking for a script which will look into both folders and find the most recently modified .bkf file and copy it to another location. There are other files in the folders which must be ignored.</p>
  
  <p>Thanks in advance!!</p>
  
  <p>Shaun</p>
  
  <p>Edit:</p>
  
  <p>I knocked this together:</p>
  
  <pre><code>cp ls -alt /Volumes/E /Volumes/F| grep bkf | head -n 1 | awk '{print $8}' /Volumes/$xservedisk/Windows/ 
  </code></pre>
  
  <p>Can anyone think of any reasons why I shouldnt use it?</p>
  
  <p>Thanks again
  Shaun</p>