public function listByPrefix($pathPrefix, $noRecursion = null) { $pathPrefix = $this->_getAbsolutePath($pathPrefix); if ('' !== $pathPrefix) { $pathPrefix .= '/'; } $commandOptions = array('Bucket' => $this->_bucket, 'Prefix' => $pathPrefix); if ($noRecursion) { $commandOptions['Delimiter'] = '/'; } $iteratorOptions = array('return_prefixes' => true); $fileKeys = $directoryKeys = array(); foreach ($this->_client->getIterator('ListObjects', $commandOptions, $iteratorOptions) as $file) { if (isset($file['Prefix'])) { $directoryKeys[] = $this->_getRelativePath($file['Prefix']); } else { $fileKeys[] = $this->_getRelativePath($file['Key']); } } return array('files' => $fileKeys, 'dirs' => $directoryKeys); }