title: How do I delete/count objects in a s3 bucket?
body: <p>So I know this is a common question but there just doesn't seem to be any good answers for it.</p>
  
  <p>I have a bucket with gobs (I have no clue how many) number of files in them. They are all within 2k a piece.</p>
  
  <p>1) How do I figure out how many of these files I have <strong>WITHOUT listing</strong> them?
     I've used the s3cmd.rb, aws/s3, and jets3t stuff and the best I can find is a command to count the first 1000 records (really performing GETS on them).</p>
  
  <p>I've been using jets3t's applet as well cause it's really nice to work with but even that I can't list all my objects cause I run out of heap space. (presumably cause it is peforming GETS on all of them and keeping them in memory)</p>
  
  <p>2) How can I just delete a bucket?
     The best thing I've seen is a paralleized delete loop and that has problems cause sometimes it tries to delete the same file. This is what all the 'deleteall' commands that I've ran across do.</p>
  
  <p>What do you guys do who have boasted about hosting millions of images/txts?? What happens when you want to remove it?</p>
  
  <p>3) Lastly, are there alternate answers to this? All of these files are txt/xml files so I'm not even sure S3 is such a concern -- maybe I should move this to a document database of sorts??</p>
  
  <p>What it boils down to is that the amazon S3 API is just straight out missing 2 very important operations -- COUNT and DEL_BUCKET. (actually there is a delete bucket command but it only works when the bucket is empty) If someone comes up with a method that does not suck to do these two operations I'd gladly give up lots of bounty.</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>Just to answer a few questions. The reason I ask this was I have been for the past year or so been storing hundreds of thousands, more like millions of 2k txt and xml documents. The last time, a couple of months ago, I wished to delete the bucket it literally took DAYS to do so because the bucket has to be empty before you can delete it. This was such a pain in the ass I am fearing ever having to do this again without API support for it.</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>this rocks the house!</p>
  
  <p><strong><a href="http://github.com/SFEley/s3nuke/" rel="nofollow noreferrer">http://github.com/SFEley/s3nuke/</a></strong></p>
  
  <p>I rm'd a good couple gigs worth of 1-2k files within minutes.</p>