Skip to content

Instantly share code, notes, and snippets.

@jdaviderb
Last active August 2, 2022 02:47
Show Gist options
  • Save jdaviderb/49552ebdfe2c62fd6c3433f6a080b284 to your computer and use it in GitHub Desktop.
Save jdaviderb/49552ebdfe2c62fd6c3433f6a080b284 to your computer and use it in GitHub Desktop.
S3 Metadata
# Get S3 metadata
aws s3 ls s3://YOUR_S3_BUCKET --recursive --summarize --human-readable
# Group files by extension
aws s3 ls s3://YOUR_S3_BUCKET --recursive \
| grep -v -E '^.+/$' \
| awk '{na=split($NF, a, "."); tot[a[na]] += $3; num[a[na]]++;} END {for (e in tot) printf "%15d %6d %s\n", tot[e], num[e], e};'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment