查询目录信息.

@param string $bucketName bucket名称
@param string $path       目录路径

@return array
186794
public static function statFolder($bucketName, $path)
    {
        $path = self::normalizerPath($path, true);

        return self::statBase($bucketName, $path);
    }
676533
function getCertificates($path)
    {
        return collect($this->files->scandir($path))->filter(function ($value, $key) {
            return ends_with($value, '.crt');
        })->map(function ($cert) {
            $certWithoutSuffix = substr($cert, 0, -4);
            return substr($certWithoutSuffix, 0, strrpos($certWithoutSuffix, '.'));
        })->flip();
    }
1278746
public function getMappingFiles($path)
    {
        $files = $this->files->glob($path.'/*_*.php');

        if ($files === false) {
            return [];
        }

        $files = array_map(function ($file) {
            return str_replace('.php', '', basename($file));
        }, $files);

        return $files;
    }
710179
protected function _scandir($path) {
		$files = array();
		
		foreach (scandir($path) as $name) {
			if ($name != '.' && $name != '..') {
				$files[] = $path.DIRECTORY_SEPARATOR.$name;
			}
		}
		return $files;
	}
1107551
private function getS3Args($path)
    {
        $parts = explode('/', str_replace('s3://', '', $path), 2);
        $args = ['Bucket' => $parts[0]];
        if (isset($parts[1])) {
            $args['Key'] = $parts[1];
        }

        return $args;
    }
526542
def listdir(self, path='/'):
        
        container = self._get_bucket()
        objects = self.driver.list_container_objects(container)
        path = self._clean_name(path)
        if not path.endswith('/'):
            path = "%s/" % path
        files = []
        dirs = []
        # TOFIX: better algorithm to filter correctly
        # (and not depend on google-storage empty folder naming)
        for o in objects:
            if path == '/':
                if o.name.count('/') == 0:
                    files.append(o.name)
                elif o.name.count('/') == 1:
                    dir_name = o.name[:o.name.index('/')]
                    if dir_name not in dirs:
                        dirs.append(dir_name)
            elif o.name.startswith(path):
                if o.name.count('/') <= path.count('/'):
                    # TOFIX : special case for google storage with empty dir
                    if o.name.endswith('_$folder$'):
                        name = o.name[:-9]
                        name = name[len(path):]
                        dirs.append(name)
                    else:
                        name = o.name[len(path):]
                        files.append(name)
        return (dirs, files)
267610
def getfiles(self, path, ext=None, start=None, stop=None, recursive=False):
        
        from .utils import connection_with_anon, connection_with_gs

        parse = BotoClient.parse_query(path)

        scheme = parse[0]
        bucket_name = parse[1]

        if scheme == 's3' or scheme == 's3n':
            conn = connection_with_anon(self.credentials)
            bucket = conn.get_bucket(parse[1])
        elif scheme == 'gs':
            conn = connection_with_gs(bucket_name)
            bucket = conn.get_bucket()
        else:
            raise NotImplementedError("No file reader implementation for URL scheme " + scheme)

        keys = BotoClient.retrieve_keys(
            bucket, parse[2], prefix=parse[3], postfix=parse[4], recursive=recursive)
        keylist = [key.name for key in keys]
        if ext:
            if ext == 'tif' or ext == 'tiff':
                keylist = [keyname for keyname in keylist if keyname.endswith('tif')]
                keylist.append([keyname for keyname in keylist if keyname.endswith('tiff')])
            else:
                keylist = [keyname for keyname in keylist if keyname.endswith(ext)]

        keylist.sort()
        keylist = select(keylist, start, stop)

        return scheme, bucket.name, keylist
76761
protected function extractParameterNames($path) {
        $names = [];
        $matches = [];
        preg_match_all('#\{([a-zA-Z0-9?]+)\}#', $path, $matches);

        foreach (array_get($matches, 1, []) as $name) {
            $names[] = str_replace('?', '', $name);
        }

        return $names;
    }
725172
public static function pathinfo($path)
    {
        $pathinfo = compact('path');

        if ('' !== $dirname = dirname($path)) {
            $pathinfo['dirname'] = static::normalizeDirname($dirname);
        }

        $pathinfo['basename'] = static::basename($path);

        $pathinfo += pathinfo($pathinfo['basename']);

        return $pathinfo + ['dirname' => ''];
    }
874144
public function cp($path, $filename)
    {
        if (!file_exists($path)) {
            return false;
        }
        
        $type = mime_content_type($path);

        $handle = fopen($path, 'r');
        $body   = fread($handle, filesize($path));

        fclose($handle);

        $result = $this->client
            ->putObject(array(
                'Bucket'      => $this->name,
                'Key'         => $filename,
                'ContentType' => $type,
                'Body'        => $body
            ));

        return $result;
    }
1170504
public function getMetaData(string $path): array
    {
        $location = $this->applyBasePath($path);
        $info     = new SplFileInfo($location);
        $metadata = $this->normalizeFileInfo($info);

        unset($location, $info);

        return $metadata === null ? [] : $metadata;
    }
661996
protected function explode_path($path) {
        $parts = explode('/', $path, 2);
        if (isset($parts[1]) && $parts[1] !== '') {
            list($bucket, $uri) = $parts;
        } else {
            $bucket = $parts[0];
            $uri = '';
        }
        return array($bucket, $uri);
    }
915024
private function getPhpFilesMatchingPatternForCommandFromGivenPath($path)
    {
        $folders = ['Commands','commands','Command'];
        foreach ($folders as $f) {
            $cPath = $path . DIRECTORY_SEPARATOR . $f . DIRECTORY_SEPARATOR;

            if (!is_dir($cPath)) {
                continue;
            }
            $files = glob("$cPath*[cC]ommand\.php");

            return $files;
        }
        return [];
    }
706979
protected function folderDetails($path)
    {
        $path = '/'.ltrim($path, '/');

        return [
            'name'     => basename($path),
            'mimeType' => 'folder',
            'fullPath' => $path,
            'modified' => $this->fileModified($path),
        ];
    }
405120
public static function delFolder($bucketName, $path) {
        $path = self::normalizerPath($path, True);

        return self::delBase($bucketName, $path);
    }
807373
public function getMetadata($path)
    {
        $object = $this->applyPathPrefix($path);

        try {
            $result = $this->client->getObjectMeta($this->bucket, $object);
        } catch (OssException $e) {
            return false;
        }

        return [
            'type'      => 'file',
            'dirname'   => Util::dirname($path),
            'path'      => $path,
            'timestamp' => strtotime($result['last-modified']),
            'mimetype'  => $result['content-type'],
            'size'      => $result['content-length'],
        ];
    }
688247
public function read($path) {
			try {
				return ['contents' => $this->bucket->getFileByName($path)->download()];
			} catch (\Exception $e) {
				throw new B2FlysystemException('Error retrieving file', B2FlysystemException::B2_SDK_ERROR, $e);
			}
		}