note 102498 added to function.filemtime

[email protected] Thu, 17 Feb 2011 10:22:14 -0800
Newsgroups php.notes
Message-ID <[email protected]>
Here is a handy script to create a csv file with file names and the date when files in a given folder were inserted:

<?php
  header("Pragma: public");
  header("Cache-Control: private");
  header("Content-Type: text/csv");
  header("Content-Disposition: attachment; filename=age-of-files.csv");

  $result = array();
  $handle =  opendir(".");
     while ($datei = readdir($handle)) 
     {
          if (($datei != '.') && ($datei != '..')) 
          {
               $file = "./".$datei;
               if (!is_dir($file))
                    $result[] = $file;
          }
     }
     closedir($handle);
  foreach($result as $r)
    if (file_exists($r))
      echo substr($r,2).",".date ("m/d/Y", filemtime($r))."\r\n";
?>
----
Server IP: 69.147.83.197
Probable Submitter: 12.22.207.3
----
Manual Page -- http://www.php.net/manual/en/function.filemtime.php
Edit        -- https://master.php.net/note/edit/102498
Del: integrated  -- https://master.php.net/note/delete/102498/integrated
Del: useless     -- https://master.php.net/note/delete/102498/useless
Del: bad code    -- https://master.php.net/note/delete/102498/bad+code
Del: spam        -- https://master.php.net/note/delete/102498/spam
Del: non-english -- https://master.php.net/note/delete/102498/non-english
Del: in docs     -- https://master.php.net/note/delete/102498/in+docs
Del: other reasons-- https://master.php.net/note/delete/102498
Reject      -- https://master.php.net/note/reject/102498
Search      -- https://master.php.net/manage/user-notes.php