[PHP] Read file dates for most recent

2002-08-13 Thread Mike Davis

I need to read a directory full of PDF files, and get the file date of the
most recent.
Can someone get me started?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Read file dates for most recent

2002-08-13 Thread Bas Jobsen

Op dinsdag 13 augustus 2002 23:25, schreef Mike Davis:
 I need to read a directory full of PDF files, and get the file date of the
 most recent.
 Can someone get me started?

?php
// Note that !== did not exist until 4.0.0-RC2
$dir='/home/allop/';
if ($handle = opendir($dir))
{
echo Directory handle: $handle\n;
$lasttime=0;
$lastfile='';
while (false !== ($file = readdir($handle)))
{
   
if(is_file($file)  filemtime($file)$latime)
{
   $lasttime=filemtime($file);
   $lastfile=$file;
}
}
}
echo $lastfile.':'.date('r',$lasttime),'\n';
?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php