Skip to content

Instantly share code, notes, and snippets.

View chaimackerman's full-sized avatar

Chaim Ackerman chaimackerman

View GitHub Profile
@cablespaghetti
cablespaghetti / s3-content-type-fix.sh
Last active October 6, 2023 06:52
Find all files in S3 bucket with specific content-type
aws s3 ls s3://mybucket/ --recursive | awk '{print $4}' | parallel 'echo {}; if [ "$(aws s3api head-object --bucket mybucket --output json --key {} | jq .ContentType -r)" = "binary/octet-stream" ]; then echo {} >> dodgy.txt; fi'
cat dodgy.txt | grep png | parallel 'echo {}; aws s3 cp --content-type="image/png" --metadata-directive="REPLACE" s3://mybucket/{} s3://mybucket/{}'