How to get directory size with PHP

How to get directory size with PHP

 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; }

The post How to Get Directory Size with PHP first appeared on Lenix Blog .

This article is reprinted from https://blog.p2hp.com/archives/8741
This site is for inclusion only, and the copyright belongs to the original author.

Leave a Comment