Deleting underscored filenames from a bucket

Published: Monday, Dec 15, 2014 Last modified: Saturday, Oct 16, 2021

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