php - AWS get all objects inside of folder in S3 -


i urls of objects stored in folder. have 1 level of folders not concerned nested folders. have read php client api (http://docs.aws.amazon.com/aws-sdk-php/v2/api/class-aws.s3.s3client.html) s3 can't seem find way accomplish this.

i found code stackoverflow size of contents:

list<bucket> buckets = s3.listbuckets(); long totalsize  = 0; int  totalitems = 0; (bucket bucket : buckets) {     objectlisting objects = s3.listobjects(bucket.getname());     {         (s3objectsummary objectsummary : objects.getobjectsummaries()) {             totalsize += objectsummary.getsize();             totalitems++;         }         objects = s3.listnextbatchofobjects(objects);     } while (objects.istruncated());     system.out.println("you have " + buckets.size() + " amazon s3 bucket(s), " +                     "containing " + totalitems + " objects total size of " + totalsize + " bytes."); } 

which close want, except not want items in bucket, want items in bucket's folder. second question how need spend accomplish there doesn't seem get/put commands being used not sure how amazon charges operation?

listobjects takes prefix argument. prefix "directory" inside bucket.


Comments

Popular posts from this blog

java - Spring Data JPA: Why findOne(id) executing delete query internally? -

python - Mongodb How to add addtional information when aggregating? -

java - Incorrect order of records in M-M relationship in hibernate -