Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Senior Coder
    Join Date
    Jun 2002
    Location
    near Oswestry
    Posts
    4,508
    Thanks
    0
    Thanked 0 Times in 0 Posts

    problem with last modified on file list

    I'm using code like this

    PHP Code:
    $dir_handle opendir($filePath);

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

    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?
    Last edited by brothercake; 01-28-2003 at 11:49 AM.

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Location
    UK
    Posts
    577
    Thanks
    0
    Thanked 0 Times in 0 Posts
    It shouldn't do, though I 'spose if it is, it does.

    Perhaps try

    filemtime($file);
    Ökii - formerly pootergeist
    teckis - take your time and it'll save you time.

  • #3
    Senior Coder
    Join Date
    Jun 2002
    Location
    near Oswestry
    Posts
    4,508
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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
    Last edited by brothercake; 01-28-2003 at 02:56 PM.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •