-
-
Save patrickpierson/ecc7a71028ad8117407c3b031390217a to your computer and use it in GitHub Desktop.
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/bash | |
if [ -z "$1" ]; then | |
echo "-----------------------------" | |
aws s3 ls | awk '{print $3}' | |
echo "-----------------------------" | |
echo "Please enter a bucket name -- s3du bucket-name" | |
else | |
s3du=$(aws s3 ls s3://$1 --recursive | grep -v -E "(Bucket: |Prefix: |LastWriteTime|^$|--)" | awk 'BEGIN {total=0}{total+=$3}END{print total/1024/1024" MB"}') | |
printf "Bucket $1 is " | |
echo $s3du | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment