Calculates total size of all files
@return mixed
334581
public function getRootTotalSize() {
        $path = rtrim($this->path_to_files, '/') . '/';
        $result = $this->getDirSummary($path);
        return $result['size'];
    }
754551
public function getUsedVolumeAttribute()
    {

        $content = $this->content;

        if (! is_null($content))
            return $content->sum(function ($item) {

                return $item->type->volume;
            });

        return 0.0;
    }
308300
protected function getResourceLength(): int
    {
        if (null === $this->fileName) {
            return parent::getResourceLength();
        }

        if (substr($this->fileName, 0, 16) === 'compress.zlib://') {
            return filesize(substr($this->fileName, 16));
        } elseif (substr($this->fileName, 0, 17) === 'compress.bzip2://') {
            return filesize(substr($this->fileName, 17));
        }

        return parent::getResourceLength();
    }
726795
public function getSize()
    {
        $filePath = $this->getPathname();
        $size = -1;
        $isWin = (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN');
        $execWorks = (function_exists('exec') && !ini_get('safe_mode') && exec('echo EXEC') == 'EXEC');
        if ($isWin) {
            if ($execWorks) {
                $cmd = "for %F in (\"$filePath\") do @echo %~zF";
                exec($cmd, $output);
                if (is_array($output)) {
                    $result = trim(implode("\n", $output));
                    if (ctype_digit($result)) {
                        $size = $result;
                    }
                }
            }
            // try the Windows COM interface if its fails
            if (class_exists('COM') && $size > -1) {
                $fsobj = new \COM('Scripting.FileSystemObject');
                $file = $fsobj->GetFile($filePath);
                $result = $file->Size;
                if (ctype_digit($result)) {
                    $size = $result;
                }
            }
        } else {
            $result = trim("stat -c%s $filePath");
            if (ctype_digit($result)) {
                $size = $result;
            }
        }
        if ($size < 0) {
            $size = filesize($filePath);
        }
        return $size;
    }
1285600
public function size(): int {
        if ($this->tail > $this->head) return 0;
        return $this->head - $this->tail;
    }
634527
public static function directory_size($dir)
    {
        $size = 0;
        foreach(new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($dir, \FilesystemIterator::CURRENT_AS_FILEINFO | \FilesystemIterator::SKIP_DOTS)) as $file => $key) {
            if ($key->isFile()) {
                $size += $key->getSize();
            }
        }
        return $size;
    }
293487
public function getLength()
	{
		if (is_null($this->length)) {
			$this->length = filesize($this->path);
		}
		return $this->length;
	}
1169286
public function getRootTotalSize()
	{
		$path = rtrim($this->rootWrapperPath, '/') . '/';
		$result = $this->getDirSummary($path);
		return $result['size'];
	}
1062463
def size(self):
        
        dir_size = 0
        for f in self.iterfiles(abspath=True):
            dir_size += os.path.getsize(f)
        return dir_size
1038299
def file_sizes(self):
        """"""
        size = sum(map(os.path.getsize, self.file_list))
        return size / 1024 / 1024
1138088
public function filesize()
	{
		if (!$this->filename)
		{
			throw new FilesystemException('File not open');
		}

		// Capture PHP errors
		$php_errormsg = '';
		$trackErrors  = ini_get('track_errors');
		ini_set('track_errors', true);
		$res = @filesize($this->filename);

		if (!$res)
		{
			$tmpError = '';

			if ($php_errormsg)
			{
				// Something went wrong.
				// Store the error in case we need it.
				$tmpError = $php_errormsg;
			}

			$res = Helper::remotefsize($this->filename);

			if (!$res)
			{
				// Restore error tracking to what it was before.
				ini_set('track_errors', $trackErrors);

				if ($tmpError)
				{
					// Use the php_errormsg from before
					throw new FilesystemException($tmpError);
				}

				// Error but nothing from php? How strange! Create our own
				throw new FilesystemException('Failed to get file size. This may not work for all streams.');
			}

			$this->filesize = $res;
			$retval         = $res;
		}
		else
		{
			$this->filesize = $res;
			$retval         = $res;
		}

		// Restore error tracking to what it was before.
		ini_set('track_errors', $trackErrors);

		// Return the result
		return $retval;
	}
688513
def _calc_size(self):
        
        return sum(os.path.getsize(filename)
            for filename in self.walk()
        )
535645
public function getReadableFilesize()
    {
        $size = $this->filesize;
        if ($size < 1) {
            return $size;
        }

        if ($size < 1024) {
            return $size.'b';
        } else {
            $help = $size / 1024;
            if ($help < 1024) {
                return round($help, 1).'kb';
            } else {
                return round(($help / 1024), 1).'mb';
            }
        }
    }
1014826
public function getSize()
    {
        if ($this->size === null && $this->storage->supportsSize()) {
            $this->size = $this->storage->getSize($this->key);
        }

        return $this->size;
    }
148827
def get_total_size(self, *files):
        

        # Recursive unpack an eventual list of lists
        def iterate(item):
            if isinstance(item, (list, tuple)):
                for i in item:
                    for ii in iterate(i):
                        yield ii
            else:
                yield item

        # Calculate the total size of the given objects starting with an
        # initial size of 0
        return reduce(lambda x, y: x + y,
                      map(self.get_filesize, iterate(files)), 0)
1224094
protected function getAutomaticChunkSize()
    {
        $nh = $this->app->make('helper/number');
        // Maximum size of an uploaded file, minus a small value (just in case)
        $uploadMaxFilesize = (int) $nh->getBytes(ini_get('upload_max_filesize')) - 100;
        // Max size of post data allowed, minus enough space to consider other posted fields.
        $postMaxSize = (int) $nh->getBytes(ini_get('post_max_size')) - 10000;
        if ($uploadMaxFilesize < 1 && $postMaxSize < 1) {
            return 2000000;
        }
        if ($uploadMaxFilesize < 1) {
            return $postMaxSize;
        }
        if ($postMaxSize < 1) {
            return $uploadMaxFilesize;
        }

        return min($uploadMaxFilesize, $postMaxSize);
    }
501736
protected function calculateSize()
    {
        $size = 0;

        if (($this->dataSize + $this->metaSize) > 127) {
            $size += 3;
        }

        if (count($this->binnArr) > 127) {
            $size += 3;
        }

        $this->size = ($this->dataSize + $this->metaSize) + $size;
        return $this->size;
    }