Created
February 16, 2018 20:48
-
-
Save delip/4d34d1dd5fa22eebf6a8e7b0f5d14c58 to your computer and use it in GitHub Desktop.
`du -sh *` like script for an AWS bucket with mutliple keys
This file contains 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 | |
BUCKET=$1 | |
for obj in `aws s3 ls s3://$BUCKET/ | perl -pe 's/.*(PRE )(.*)/$2/'` | |
do | |
size=`aws s3 ls s3://$BUCKET/$obj --recursive --human --summarize | grep "Total Size" | cut -f2 -d':' | perl -pe 's/^\s+//g'` | |
printf "$obj\t$size\n" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment