Skip to content

Instantly share code, notes, and snippets.

@schen1628
Last active August 29, 2015 14:08
Show Gist options
  • Save schen1628/e99846797cec7654d67c to your computer and use it in GitHub Desktop.
Save schen1628/e99846797cec7654d67c to your computer and use it in GitHub Desktop.
#!/bin/bash
#
# This script goes through each bucket in s3 and prints out the header for each object.
#
for bucket in `aws s3 ls | awk '{print $3}'`
do
for object in `aws s3 ls s3://$bucket --recursive | awk '{print $4}'`
do
printf "OBJECTS\t$bucket\t$object\t"
aws s3api head-object --bucket $bucket --output text --key '$object'
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment