Skip to content

Instantly share code, notes, and snippets.

@nickperkins
Last active April 21, 2021 21:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nickperkins/075cf7797672b1ecbb101470f56e8a24 to your computer and use it in GitHub Desktop.
Save nickperkins/075cf7797672b1ecbb101470f56e8a24 to your computer and use it in GitHub Desktop.
Delete empty files from s3
aws s3api list-objects --bucket my-bucket-name --output json --query 'Contents[?Size==`0`]' | jq -r '.[] | [.Key] | @tsv' | xargs -n 1 sh -c 'aws s3 rm s3://my-bucket-name/$@' bash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment