Skip to content

Commit

Permalink
feat: add script s3size
Browse files Browse the repository at this point in the history
  • Loading branch information
yue4u committed Jul 15, 2023
1 parent 000000a commit 5b31c77
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions scripts/s3size
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
bucketlist=`aws s3 ls | cut -d ' ' -f 3`
echo -e "Bucket\tObjectCount\tTotalSize\n"
for x in ${bucketlist}; do
echo -en "$x\t"; aws s3 ls s3://$x --recursive | grep -v -E "(Bucket: |Prefix: |LastWriteTime|^$|--)" | awk 'BEGIN {count=0; total=0}{count++; total+=$3}END{print count"\t"total" ("total/2^30"GB)\t$"(total/2^30)*0.023}'
done

0 comments on commit 5b31c77

Please sign in to comment.