Author Archives: editor_w

AWS: how to get a number of files in S3 bucket

If you’re regularly using AWS S3, you might have wondered how to count the number of files in a bucket.

Technically, getting the files count information for a S3 bucket is easy and straightforward. Read on as we demonstrate some ways to accomplish this.

1. Using AWS Metrics section

  1. Go to AWS S3 Console
  2. Select a bucket to get the number of files
  3. Go to the Metrics section
  1. Get the number from the “Total number of objects” metric

2. AWS CLI

Also, you can use next AWS CLI commands:

aws s3 ls s3://your-s3-bucket/ --recursive | ws -l

>> 80

or

aws s3 ls s3://your-s3-bucket/ --recursive --summarize | grep "Total Objects:"

>> Total Objects: 80