Jump to content

how do i get the size of a directory


Jackthumper

Recommended Posts

found this soloution once

 

 

<?php
/**
* Get the directory size
* @param directory $directory
* @return integer
*/
function dirSize($directory) {
    $size = 0;
    foreach(new RecursiveIteratorIterator(new RecursiveDirectoryIterator($directory)) as $file){
        $size+=$file->getSize();
    }
    return $size;
}
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.