- How to get the newest file in a directory in php
- $myFile = "data/FrontlineSMS_Message_Export_20120721.csv"; //The name of the CSV file
- $fh = fopen($myFile, 'r'); //Open the file
- $files = scandir('data', SCANDIR_SORT_DESCENDING);
- $newest_file = $files[0];