---
title: "Comment by Tobias Schmidt on \"Step-By-Step: Emptying S3 Buckets and Directories Using the AWS CLI with S3 RM\" | Hashnode"
description: "Hi Shaheer! If you want to delete a bucket with a huge number of files, there&#39;s a simple secret: create a lifecycle rule that expires all of your files. Thi"
url: "https://hashnode.com/posts/aws-s3-rm-removing-files/6423bd7544c6044aa5f7c893/comment/6480ba05dc966543c1f9e112"
---

[Discussion](https://hashnode.com/posts/aws-s3-rm-removing-files/6423bd7544c6044aa5f7c893)

Comment [Step-By-Step: Emptying S3 Buckets and Directories Using the AWS CLI with S3 RM](https://hashnode.com/posts/aws-s3-rm-removing-files/6423bd7544c6044aa5f7c893)

[Tobias Schmidt](https://hashnode.com/@tpschmidt)

[Jun 7, 2023](https://hashnode.com/posts/aws-s3-rm-removing-files/6423bd7544c6044aa5f7c893/comment/6480ba05dc966543c1f9e112)

Hi Shaheer!

If you want to delete a bucket with a huge number of files, there's a simple secret: create a lifecycle rule that expires all of your files.

This way you don't need a blocking command and AWS will take care of deleting the files in a background process.

This works with an unlimited number of files 💪
