File Modification Date/Time
| From: | Christopher J. Crane | Date: | Fri, 03 Jan 2003 16:04:56 +0000 |
| Subject: | File Modification Date/Time | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-130112@lists.php.net to get a copy of this message | ||
I am trying to parse through a directory and get the modification dates of
the file.
<?PHP
$DirToCheck = "tempdata/";
if ($handle = opendir($DirToCheck)) {
while (false !== ($file = readdir($handle))) {
echo " $file - Last Modified: " . date("F d Y
H:i:s.",
filemtime($file)) . "<br>\n";
}
closedir($handle);
}
?>
All the files are coming back with a date of December 31 1969 19:00:00. What
am I doing wrong? The next step is I want to check if the file is older than
30 minutes and if so, I want to delete it. How would I go about that?