Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

filemtime problem on Windows server

Status
Not open for further replies.

combs

Programmer
Apr 18, 2002
78
US
I am trying to get the file modified time on all files in a directory and it keeps getting December 31 1969 as the last modification time...

Here's the code:
Code:
if (is_dir($dir))
        {
         if ($dh = opendir($dir))
          {
           while (($pictname = readdir($dh)) !== false)
            {
             if (($pictname != ".") && ($pictname != "..") && ($pictname != "_vti_cnf"))
              {
               $count++;
               $PicList[$count] = $strPicPath."/".$pictname;
               $PicTime[$count] = date("F d Y", filemtime($pictname));
              }
             }
            closedir($dh);
            $intNumPicts = $count;
           }
         }
I would appreciate any help/suggestions/tips you can offer...
 
combs,

Are you sure that $pictname is returning a valid filename? Make sure the path to the file are correct. (i.e. absolute or relative... C:\blah\foo.txt or ../blah/foo.txt)


Thanks,
Ron

typedef map<GiantX,gold, less<std::shortestpathtogold> > AwesomeMap;
 
Sounds like it's returning -1 as your filemtime. I'd start there.
 
ronnyjljr,

You were correct. It's working now that I have the full path. Here's the working code:

Code:
if (is_dir($dir))
  {
   if ($dh = opendir($dir))
    {
     while (($pictname = readdir($dh)) !== false)
      {
       if (($pictname != ".") && ($pictname != "..") && ($pictname != "_vti_cnf"))
        {
         $count++;
         $PicList[$count] = $strPicPath."/".$pictname;
         [b]$PicTime[$count] = date("F d Y", filemtime($PicList[$count]));[/b]
        }
       }
      closedir($dh);
      $intNumPicts = $count;
     }
   }

Thanks for your help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top