IamCalvinBrown.com a Blog Site

Code Examples, Consulting Advice and lots of other cool things

AWS CLI - Delete all files matching a filter in an S3 bucket

Amazon AWS can be amazing and interesting to deal with at times. When you host a static website using S3 and Route 53, it sometimes creates files for each request the service receives. To purge these files and avoid having tens of thousands or even millions of useless files, use this command on your local CLI:

#Delete all files that name start with "2018" files from the bucket:

aws s3 rm s3://[your-aws-bucket-name]/ --recursive --exclude '*' --include '2018*'

Comments (2) -

  • prashanth

    3/14/2019 11:52:25 AM |

    useful information.
    thanks for posting .
    keep sharing.
    <a href="https://bit.ly/2IG5YWf";>best aws cloud training in Bengaluru</a>