Created
February 5, 2020 08:07
-
-
Save prasanjit-/2ceaf4061a4b388dd2285343f13de957 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//Php Script to detect the files changed in a project recursively after a certain date | |
//Put here the directory you want to search for. Put / if you want to search your entire domain | |
$dir='/path/to/public_html'; | |
//Put the date you want to compare with in the format of: YYYY-mm-dd hh:mm:ss | |
$comparedatestr="2020-01-21 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>"; | |
} | |
} | |
} | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment