public function getSize($force = false, $formatted = false, $precision = 2) { if ($this->_size == null || $force) { $this->recalculateSize(); } return $formatted ? FsUtil::bytesToHuman($this->_size, $precision) : $this->_size; }
/** * Get the total size (recursive) of a directory. * * @return float Number of bytes on success, or false on failure. */ public function getTotalSize($formatted = false, $precision = 2) { $bytes = 0; $iter = new RecursiveDirectoryIterator($this->getAbsolute()); foreach (new RecursiveIteratorIterator($iter) as $p) { $bytes += $p->getSize(); } return $formatted ? FsUtil::bytesToHuman($bytes, $precision) : $bytes; }