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:
1 2 |
aws s3 rm s3://test-bucket/data/* |
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:
1 2 |
aws s3 rm s3://test-bucket --recursive --exclude="*" --include="data/*.*" |