Folder::size PHP Method

size() public method

Returns the entire size of the directory and all its contents
public size ( ) : integer
return integer
    public function size()
    {
        $size = 0;
        $items = $this->content(array('.', '..'));
        foreach ($items as $item) {
            $size += $item->size();
        }
        return $size;
    }

Usage Example

Example #1
0
 /**
  * Gets the size of the directory and all subfolders and files
  *
  * @param   string $dir The path of the directory
  * @return  mixed
  */
 public static function size($dir)
 {
     if (!file_exists($dir)) {
         return false;
     }
     // It's easier to handle this with the Folder class
     $object = new Folder($dir);
     return $object->size();
 }
All Usage Examples Of Folder::size