Deleting underscored filenames from a bucket

Published: Monday, Dec 15, 2014 Last modified: Monday, Nov 23, 2020

Using the AWS cli and a fairly straightforward shell:

aws s3 ls --recursive s3://BUCKET | grep -F "._" | awk '{print $4}' | while read delme; do echo aws s3 rm s3://BUCKET/$delme; done