note 68868 added to function.filemtime
| From: | (benantumkayaatyahoo) | Date: | Mon, 14 Aug 2006 09:11:59 +0000 |
| Subject: | note 68868 added to function.filemtime | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-115883@lists.php.net to get a copy of this message | ||
Here is a small but handy script that you can use to find which files in your server are modified
after a date/time that you specify. This script will go through all folders in the specified
directory recursively and echo the modified files with the last modified date/time...
//Starts Here
//Put here the directory you want to search for. Put / if you want to search your entire domain
$dir='/';
//Put the date you want to compare with in the format of: YYYY-mm-dd hh:mm:ss
$comparedatestr="2006-08-12 00:00:00";
$comparedate=strtotime($comparedatestr);
//I run the function here to start the search.
directory_tree($dir,$comparedate);
//This is the function which is doing the search...
function directory_tree($address,$comparedate){
@$dir = opendir($address);
if(!$dir){ return 0; }
while($entry = readdir($dir)){
if(is_dir("$address/$entry") && ($entry != ".."
&& $entry != ".")){
directory_tree("$address/$entry",$comparedate);
}
else {
if($entry != ".." && $entry != ".") {
$fulldir=$address.'/'.$entry;
$last_modified = filemtime($fulldir);
$last_modified_str= date("Y-m-d h:i:s", $last_modified);
if($comparedate < $last_modified) {
echo $fulldir.'=>'.$last_modified_str;
echo "<BR>";
}
}
}
}
}
----
Server IP: 85.116.0.130
Probable Submitter: 195.224.156.170
----
X-Spam-Status: No, hits=3.3 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER,
HTML_MESSAGE autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/function.filemtime.php
Edit -- https://master.php.net/note/edit/68868
Del: integrated -- https://master.php.net/note/delete/68868/integrated
Del: useless -- https://master.php.net/note/delete/68868/useless
Del: bad code -- https://master.php.net/note/delete/68868/bad+code
Del: spam -- https://master.php.net/note/delete/68868/spam
Del: non-english -- https://master.php.net/note/delete/68868/non-english
Del: in docs -- https://master.php.net/note/delete/68868/in+docs
Del: other reasons-- https://master.php.net/note/delete/68868
Reject -- https://master.php.net/note/reject/68868
Search -- https://master.php.net/manage/user-notes.php