예제 #1
0
 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;
 }
예제 #2
0
파일: fs.php 프로젝트: noccy80/lepton-ng
 /**
  * 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;
 }