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
- Go to AWS S3 Console
- Select a bucket to get the number of files
- Go to the Metrics section
- 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