Skip to content

Instantly share code, notes, and snippets.

@bool-dev
Forked from joech4n/s3DuByPrefix.sh
Created January 3, 2018 02:39
Show Gist options
  • Save bool-dev/bd6ceed6fc3dc1796b70111bb6221843 to your computer and use it in GitHub Desktop.
Save bool-dev/bd6ceed6fc3dc1796b70111bb6221843 to your computer and use it in GitHub Desktop.

Revisions

  1. @joech4n joech4n revised this gist Jan 30, 2016. No changes.
  2. @joech4n joech4n revised this gist Jan 29, 2016. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions s3DuByPrefix.sh
    Original file line number Diff line number Diff line change
    @@ -1 +1,2 @@
    #!/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
  3. @joech4n joech4n renamed this gist Jan 29, 2016. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  4. @joech4n joech4n created this gist Jan 29, 2016.
    1 change: 1 addition & 0 deletions duByPrefix.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    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