Hello all,
How can I get a folder's attributes.
I want to get the folder size,how many files are in it and most important the folder's date
Thank you
get folder attributes
Moderator: General Moderators
You can try something like this for the directory size
Code: Select all
$dir = "dir";
function dirsize($checkdir) {
$dh = opendir($checkdir);
$size = 0;
while (($file = readdir($dh)) !== false)
if ($file != "." and $file != "..") {
$path = $checkdir."/".$file;
if (is_dir($path))
$size += dirsize($path);
elseif (is_file($path))
$size += filesize($path);
}
closedir($dh);
$formated_size = $size /1000;
return $formated_size;
}
$getFolderSize = dirsize("/files/personal");