PHP class extends SPLFileInfo
-
getRealSize() - size of directory contents (recursive) or file if isFile
-
getFileMTime() - MTime of most recent directory contents (recursive) or file if isFile
-
getHumanSize() - human readable filesize, %.2f {$factor}. default from $this->getRealSize()
$iterator = new FilesystemIterator(dirname(__FILE__));
$iterator->setInfoClass('ExtendedSPLFileInfo');
foreach ($iterator as $file) {
echo $file->getRealSize() . PHP_EOL;
}