Lists the contents of a remote directory
@param string $remote_dir
@return Array The array of files
977707
public function ls($remote_dir)
    {
        $dir = "ssh2.sftp://".$this->sftp.$remote_dir;
        $handle = opendir($dir);
        $files = Array();
        while (false !== ($file = readdir($handle))) {
            if (substr($file, 0, 1) != '.'){
                $files[] = $file;
            }
        }

        closedir($handle);

        return $files;

    }
123228
public function listContents($directory)
    {
        $files = $this->modulable->getConnection()->listContents($directory);
        $files = array_pluck($files, 'path');
        $files = array_map('basename', $files);

        return $files;
    }
498293
public function directories($directory = null, $recursive = false)
    {
        $contents = $this->driver->listContents($directory, $recursive);

        return $this->filterContentsByType($contents, 'dir');
    }
12192
def mkdirs(remote_dir, use_sudo=False):
    
    func = use_sudo and sudo or run
    result = func(' '.join(['mkdir -pv',remote_dir])).split('\n')
    #extract dir list from ["mkdir: created directory `example.com/some/dir'"]
    if result[0]: result = [dir.split(' ')[3][1:-1] for dir in result if dir]
    return result
1067808
public function listWith(array $keys = [], $directory = '', $recursive = false)
    {
        $contents = $this->listContents($directory, $recursive);

        foreach ($contents as $index => $object) {
            if ($object['type'] === 'file') {
                $missingKeys = \array_diff($keys, \array_keys($object));
                $contents[$index] = \array_reduce($missingKeys, [$this, 'getMetadataByName'], $object);
            }
        }

        return $contents;
    }
1198103
private static function getDirFiles($absolute_dir, $relative_dir, &$files) {
        $handler = opendir($absolute_dir);
        if ( $handler != false ) {
            while ( $filename = readdir($handler) ) {
                if ( $filename != "." && $filename != ".." ) {
                    if ( is_dir($absolute_dir."/".$filename) ) {
                        self::getDirFiles($absolute_dir."/".$filename, $relative_dir.$filename."/", $files);
                    } else {
                        $files[] = $relative_dir.$filename;
                    }
                }
            }
            closedir($handler);
        }
    }
902934
public function fileList()
    {
        $result = array();

        $dirContent = opendir($this->_dirPath);
        while (($file = readdir($dirContent)) !== false) {
            if (($file == '..')||($file == '.')) {   continue;
            }

            if(!is_dir($this->_dirPath . '/' . $file) ) {
                $result[] = $file;
            }
        }
        closedir($dirContent);

        return $result;
    }
1314554
public function listContents($directory = '', $recursive = false) {
			try {
				$files = $this->bucket->listFileNames(['prefix' => $directory]);
				$returnFiles = [];
				foreach ($files as $file) {
					$returnFiles[] = $this->normalizeFileInfo($file);
				}
				
				return $returnFiles;
			} catch (\Exception $e) {
				throw new B2FlysystemException('Error retrieving files', B2FlysystemException::B2_SDK_ERROR, $e);
			}
		}
81586
private function nList($dir)
    {
        $dirList = ftp_nlist($this->session, $dir);
        if ($dirList === false) {
            throw new \RuntimeException('List error');
        }
        return $dirList;
    }
113881
public function listContents($directory = '', $recursive = false)
    {
        $bucketMgr = $this->getBucketManager();

        list($items, $marker, $error) = $bucketMgr->listFiles($this->bucket, $directory);
        if ($error !== null) {
            $this->logQiniuError($error);

            return array();
        } else {
            $contents = array();
            foreach ($items as $item) {
                $normalized = [
                    'type' => 'file',
                    'path' => $item['key'],
                    'timestamp' => $item['putTime']
                ];

                if ($normalized['type'] === 'file') {
                    $normalized['size'] = $item['fsize'];
                }

                array_push($contents, $normalized);
            }

            return $contents;
        }
    }
1327016
public function listFiles($directory)
    {
        $writeBinn= new BinnList;

        $writeBinn->addUint8(self::FSERV_READDIR);
        $writeBinn->addStr($directory);     // Dir path
        $writeBinn->addUint8(0);       // Mode

        $read = $this->writeAndReadSocket($writeBinn->serialize());

        $readBinn = new BinnList;

        $readBinn->binnOpen($read);
        $results = $readBinn->unserialize();

        if ($results[0] != self::FSERV_STATUS_OK) {
            // Error
            throw new RuntimeException('GDaemon List files error:' . isset($results[1]) ? $results[1] : 'Unknown');
        }

        $filesList = $results[2];
        $returnList = [];

        foreach($filesList as &$file) {

            if (in_array(basename($file[0]), ['.', '..'])) {
                continue;
            }

            $returnList[] = basename($file[0]);
        }

        return $returnList;
    }
195763
public function listContents($dirname = '', $recursive = false)
    {
        $result = [];

        foreach ($this->cache as $object) {
            if ($object === false) {
                continue;
            }
            if ($object['dirname'] === $dirname) {
                $result[] = $object;
            } elseif ($recursive && $this->pathIsInDirectory($dirname, $object['path'])) {
                $result[] = $object;
            }
        }

        return $result;
    }
210917
private function list_directory( $dir ) {
		$dir_list = array();

		// Only add .mo/.po/.zip files
		foreach ( glob( $dir . '/*.{mo,po,zip}', GLOB_BRACE ) as $file ) {
			$dir_list[] = basename( $file );
		}

		return $dir_list;
	}
901843
public static function getDirectories($base_directory, $context, $environment, $bundle_id)
    {
        $directories = array();
        foreach (BootstrapDirectory::getDirectories($base_directory, $context, $environment) as $directory) {
            $directory .= DIRECTORY_SEPARATOR.self::OVERRIDE_BUNDLE_CONFIG_DIRECTORY_NAME
                .DIRECTORY_SEPARATOR.$bundle_id
            ;

            if (true === is_dir($directory)) {
                array_unshift($directories, $directory);
            }
        }

        return $directories;
    }
766022
public function getFilesList($dir)
	{
		$list = [];
		$iterator = Aws\recursive_dir_iterator($dir);
		foreach ($iterator as $filename) {
			$list[] = $filename;
		}
		return $list;
	}
1042861
def listdir(self, dirname):
        """"""
        client = boto3.client("s3")
        bucket, path = self.bucket_and_path(dirname)
        p = client.get_paginator("list_objects")
        if not path.endswith("/"):
            path += "/"  # This will now only retrieve subdir content
        keys = []
        for r in p.paginate(Bucket=bucket, Prefix=path, Delimiter="/"):
            keys.extend(o["Prefix"][len(path):-1] for o in r.get("CommonPrefixes", []))
            for o in r.get("Contents", []):
                key = o["Key"][len(path):]
                if key:  # Skip the base dir, which would add an empty string
                    keys.append(key)
        return keys
1334414
public function getContentIds(array $remoteIds)
    {
        $objectRemoteIdMap = [];

        if (!empty($remoteIds)) {
            $q = $this->getConnection()->createSelectQuery();
            $q
                ->select('id', 'remote_id')
                ->from('ezcontentobject')
                ->where($q->expr->in('remote_id', $remoteIds));

            $statement = $q->prepare();
            $statement->execute();
            foreach ($statement->fetchAll(\PDO::FETCH_ASSOC) as $row) {
                $objectRemoteIdMap[$row['remote_id']] = $row['id'];
            }
        }

        return $objectRemoteIdMap;
    }