title: Dynamically Get Size of Files in Amazon S3 Bucket
body: <p>I've seen previous questions on "How to find the size of an entire S3 bucket."  This is somewhat of a different question-- so I apologize in advance if it is vague.  I'll do my best to explain what I am trying to achieve.</p>
  
  <p>I am currently using <a href="http://undesigned.org.za/2007/10/22/amazon-s3-php-class" rel="noreferrer">Amazon S3 PHP Class</a>.</p>
  
  <p>This is what I am trying to achieve:</p>
  
  <ol>
  <li><p>I would like to be able to loop through my MySQL database and get specific filenames of files on my S3 server. (This may be based on user).</p></li>
  <li><p>During the loop, query the Amazon S3 bucket (somehow) and get the filesize of each file that was in my MySQL loop.</p></li>
  <li><p>Add up all the filesizes, to get one total approximate bytesize.</p></li>
  </ol>
  
  <p>So, essentially, let's say I have a user that has 5 files on the S3 bucket.  How might I be able to query the S3 bucket, to see how much data this user's 5 files is storing in my bucket?</p>
  
  <p>My apologies if this is difficult to understand.  I can re-articulate, if needed.  </p>
  
  <p>Any nudge in the right direction would be greatly appreciated.</p>