$_SERVER['DOCUMENT_ROOT']
= /home/username/public_html
how to get /home/mail
directory in PHP?
$_SERVER['DOCUMENT_ROOT']
= /home/username/public_html
how to get /home/mail
directory in PHP?
function folderSize ($dir)
{
$size = 0;
foreach (glob(rtrim($dir, '/').'/*', GLOB_NOSORT) as $each) {
$size += is_file($each) ? filesize($each) : folderSize($each);
}
return $size;
}
echo folderSize('/home/username/mail/');
you have to check if that path is correct in your server, the example is for centos and cpanel