Use wildcards to delete files on AWS S3


The aws cli tool doesn’t directly support wildcards, but there is a workaround with the --exclude and --include parameters.

aws s3 rm s3://example-bucket/ --recursive --exclude="*" --include "blah*"

Normal wildcards * and ? are allowed, but so are regex-like [chars] and [!chars].

You can test by adding --dryrun to make sure you got it right.

Details

Date: 2018-06-06

Tags:  aws

Share: