View Full Version : problem with last modified on file list

01-28-2003, 12:27 PM
I'm using code like this

$dir_handle = opendir($filePath);

while ($file = readdir($dir_handle)) {
if(ereg("\.doc",$file)) {
$mod = getlastmod($file);
$fileAry[] = array($mod,$file);


But the value returned in $mod is not the last modified date, it's today's date ..? Is that because reading the directory counts as "touching" the file, and if so what can I do?

01-28-2003, 01:08 PM
It shouldn't do, though I 'spose if it is, it does.

Perhaps try


01-28-2003, 03:48 PM
That just gave me a "no such file" error ... but it led me to try

$mod = filemtime($filePath.$file);

Which works, and so presumably means that the $file var doesn't refer to the file, but merely contains a string of its filename ...

Makes sense, but I didn't realise it was like. Ah well - thanks for the help :)