Query s3 bucket by date

PHOTO EMBED

Wed Aug 17 2022 23:25:31 GMT+0000 (UTC)

Saved by @dermarmc #bash #cc #aws-cli

SINCE=`date --date '-2 weeks +2 days' +%F 2>/dev/null || date -v '-2w' -v '+2d' +%F`
bucket=<bucketname>
aws s3api list-objects-v2 --bucket "$bucket" \
    --query 'Contents[?LastModified > `'"$SINCE"'`]'
content_copyCOPY