-
-
Save npow/6f44ce1f31ea4108b0fe72d20f59faf3 to your computer and use it in GitHub Desktop.
Get bucket size and object count by first level prefix (i.e. bucket/prefix1, bucket/prefix2)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
BUCKETNAME=mybucketname; REGION=us-east-1; for prefix in $(aws s3api list-objects --bucket $BUCKETNAME --delimiter '/' --output text --region $REGION |grep COMMONPREFIX |tail -n+2| awk '{print $2}'); do echo "Totals for $prefix"; aws s3 ls --summarize --human-readable --recursive s3://$BUCKETNAME/$prefix --region $REGION ; done |grep Total |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment