title: Get the newest file from directory structure year/month/date/time
body: <p>I store backups of databases in a directory structure</p>
  
  <p>year/month/day/time/backup_name</p>
  
  <p>an example would be</p>
  
  <p>basics_mini/2012/11/05/012232/RATIONAL.0.db2inst1.NODE0000.20110505004037.001 basics_mini/2012/11/06/012251/RATIONAL.0.db2inst1.NODE0000.20110505003930.001</p>
  
  <p>note that timestamp from the backup file cannot be used. Before the automation testing starts the server time is set to 5.5.2011</p>
  
  <p>So the question is how I can get the latest file if I pass the "base directory" (basics_mini) to some function that I am going to code. My thoughts are that I list the base directory and sort by time to get the year. Then I do the same for month, day and time.</p>
  
  <p>I wonder if there is any "easier" solution to that in php.</p>