title: How to get total objects and total storage of each folder on S3 bucket
body: <p>I have an S3 bucket named <code>camera-assets</code>, in that bucket I have a separate folder for each camera and each folder contains millions / billions of files.  I want to get a total number of files and storage of each folder in my bucket.</p>
  
  <p>I tried following CLI command:</p>
  
  <pre><code>aws s3api list-objects --bucket camera-assets --prefix 1011-front-external/snapshots/ --output json --query "[sum(Contents[].Size), length(Contents[])]"
  </code></pre>
  
  <p>But failed to get the result because folder has million/billion of files. It works if there are only a few files.</p>
  
  <p>Please help me to get files count and storage.</p>