Can we get the Directory's Modified time and size i.e. stats in php? How?
+2
A:
You can get the modified time with filemtime or SplFileInfo::getMTime.
As for getting the size of the directory, do you mean the file size of all of the contents within it (might sound like a silly question, size is ambiguous)?
If you are wanting just the recorded 'filesize' of the directory then filesize or SplFileInfo::getSize should suffice.
$dir = new SplFileInfo('path/to/dir');
printf(
"Directory modified time is %s and size is %d bytes.",
date('d/m/Y H:i:s', $dir->getMTime()),
$dir->getSize()
);
salathe
2010-05-05 12:16:07