Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get List of subfolders only in Bucket #143

Open
toutant opened this issue Feb 6, 2018 · 0 comments
Open

Get List of subfolders only in Bucket #143

toutant opened this issue Feb 6, 2018 · 0 comments

Comments

@toutant
Copy link

toutant commented Feb 6, 2018

I am able to retrieve contents of subfolder
using $s3->getBucket("pictures","0");
where "0" is the subfolder.

Is there away to request folders of bucket "pictures" without getting the list of files

--- update

i add this to the code to get folder list

public static function parseFolderReturn($rfiles){
    $a = array();
                 foreach($rfiles as $p){
                if(isset($p["prefix"])){
                     array_push($a,str_replace("/","",$p["prefix"]) );
                }

            }
    return $a;
}

public static function getFolders($bucket, $prefix = null, $marker = null, $maxKeys = null, $delimiter = "/", $returnCommonPrefixes = true)
{
 
   $r =  self::getBucket($bucket,$prefix, $marker, $maxKeys, $delimiter, $returnCommonPrefixes);
    return self::parseFolderReturn($r);
    
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant