Delete files from folder in S3 bucket

Question:

I have an AWS S3 bucket test-bucket with a data folder. The data folder will have multiple files.

I am able to delete the files in the S3 bucket.
But what I want is to delete the files in the data folder without deleting the folder.

I tried the following:

Also checked using --recursive option, but that does not work.

Is there a way I can delete the files in the folder using AWS CLI?

Answer:

Following aws cli command worked:

Leave a Reply