Skip to content

Instantly share code, notes, and snippets.

@cjdd3b
Last active June 18, 2020 18:31
Show Gist options
  • Save cjdd3b/5475c20fb28fa4a87dd89c241e703e20 to your computer and use it in GitHub Desktop.
Save cjdd3b/5475c20fb28fa4a87dd89c241e703e20 to your computer and use it in GitHub Desktop.
How to count files in an S3 bucket

Counting files in S3 buckets and folders is harder than it should be. But here's a way to get it done using s3cmd:

  1. Install S3cmd
  • On Mac, brew install s3cmd
  • On Windows, go here
  1. From the command line, run s3cmd --configure

  2. Add your credentials when prompted.

  3. Once it's all set up and working, run: s3cmd ls --recursive s3://BUCKET_NAME/FOLDER_NAME | wc -l

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment