AWS CLI 2 · S3

Delete everything under a prefix

Delete all objects under a prefix.

aws s3 rm s3://my-bucket/old/ --recursive

Caution: Deleted objects cannot be recovered unless versioning is enabled. Preview with --dryrun.

Official AWS CLI 2 documentation

More s3 commands

All s3 commands · AWS CLI 2 cheatsheet

Was this page helpful?