Skip to content

Instantly share code, notes, and snippets.

@onigra
Created December 25, 2018 09:45
Show Gist options
  • Save onigra/4391e0dde704e832da0e9a9dc160eaed to your computer and use it in GitHub Desktop.
Save onigra/4391e0dde704e832da0e9a9dc160eaed to your computer and use it in GitHub Desktop.
remove artifacts
aws s3 ls \
s3://bucket/artifacts \
--recursive \
--human-readable | \
grep manifest.yml | \
sort -r | \
tail -n+20 | \
awk -F ' ' '{ print $5 }' | \
sed -e 's/\(artifacts\/.*\)\/namespace\/manifest\.yml/s3:\/\/bucket\/\1/g' | \
xargs -I{} aws s3 rm --recursive "{}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment