note 42065 added to function.filemtime

From: Date: Sat, 01 May 2004 17:42:37 +0000
Subject: note 42065 added to function.filemtime
Groups: php.notes 
Request: Send a blank email to php-notes+get-69078@lists.php.net to get a copy of this message
The snippet of code earlier that allows you to delete all files older than 2 weeks uses the function (filemtime) - which checks the original create date of the file (filesystem independent). You MAY want to use filectime() - that looks at when the file was last changed on YOUR file system. if (is_dir("$path") ) { $handle=opendir($path); while (false!==($file = readdir($handle))) { if ($file != "." && $file != "..") { $Diff = (time() - filectime("$path/$file"))/60/60/24; if ($Diff > 14) unlink("$path/$file"); } } closedir($handle); } ---- Manual Page -- http://www.php.net/manual/en/function.filemtime.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+42065 Delete -- http://master.php.net/manage/user-notes.php?action=delete+42065&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+42065&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#69078) next »