How to Get the most recent file date using PHP
Posted: Sun Nov 29, 2009 4:56 am
When you need that most recent update date. You can use this script to get the most recent file date in a given directory. To use current directory, use "./" as the directory name.
Code: Select all
<?PHP
$path = "./"; // put the directory path here
foreach (glob($path) as $filename) if (filemtime($filename) >= $recentDate) $recentDate = filemtime($filename);
$recentDate = date(" F d, Y",$recentDate);
echo $recentDate;
?>