amazon-s3-php-class icon indicating copy to clipboard operation
amazon-s3-php-class copied to clipboard

Get List of subfolders only in Bucket

Open toutant opened this issue 7 years ago • 0 comments

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);
    
}

toutant avatar Feb 06 '18 03:02 toutant