<?php
/* http://tw.bestconverter.org/unitconverter_number.php */
$size = GetDirectorySize("folder_path");
if($size > 524288000){
echo "folder size more than 500MB";
}
function GetDirectorySize($path){
$bytestotal = 0;
$path = realpath($path);
if($path!==false && $path!='' && file_exists($path)){
foreach(new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path, FilesystemIterator::SKIP_DOTS)) as $object){
$bytestotal += $object->getSize();
}
}
return $bytestotal;
}
?>