Last active
August 4, 2020 07:12
-
-
Save zerowebcorp/f1b2ed41b2603aa331736bae728eabfe to your computer and use it in GitHub Desktop.
AWS S3 List all buckets size
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
for dir in $(aws s3 ls | awk '{print $3'}); do | |
size=$(aws s3 ls s3://${dir} --recursive | grep -v -E "(Bucket: |Prefix: |LastWriteTime|^$|--)" | awk 'BEGIN {total=0}{total+=$3}END{print total/1024/1024" MB"}'); | |
echo "${dir} => $size" | tee -a disk.txt | |
done |
Isn't megabits represents the speed of the internet connection and megabytes the size of a file?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I think it is Mb (megabits, not megabytes).