title: AWS get all objects inside of folder in S3
body: <p>I would like to get all the URLs of objects stored in a folder. I will only have one level of folders so I am not concerned with nested folders. I have read the PHP client API (<a href="http://docs.aws.amazon.com/aws-sdk-php/v2/api/class-Aws.S3.S3Client.html" rel="nofollow">http://docs.aws.amazon.com/aws-sdk-php/v2/api/class-Aws.S3.S3Client.html</a>) for S3 but can't seem to find a way to accomplish this.</p>
  
  <p>I found this code from StackOverflow to get the size of contents:</p>
  
  <pre><code>List&lt;Bucket&gt; buckets = s3.listBuckets();
  long totalSize  = 0;
  int  totalItems = 0;
  for (Bucket bucket : buckets)
  {
      ObjectListing objects = s3.listObjects(bucket.getName());
      do {
          for (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 with a total size of " + totalSize + " bytes.");
  }
  </code></pre>
  
  <p>Which is close to something I want, except I do not want all the items in a bucket, I want all the items in a certain bucket's folder. My second question is how much would I need to spend to accomplish this as there doesn't seem to be an get/put commands being used so I am not sure how much Amazon charges to for this operation?</p>