I need to run a check on a folder to see when it was last modified. By this I mean the last time it, or any of the files it contains where last modified.
I have tried two ways so far:
using the stat() function on the folder, and then grabbing mtime
$stat = stat("directory/path/"); echo $stat["mtime"];
using the
filemtime()
function on the folderecho (filemtime("directory/path/"));
Both of these methods return the same value, and this value does not change if I update one of the files. I am guessing this is because the folder structure itself does not change, only the content of one of the files.
I guess I could loop through all the files in the directory and check their modification dates, but there are potentially a lot of files and this doesn't seem very efficient.
Can anyone suggest how I might go about getting a last modification time for a folder and its content in an efficient way?