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:

```
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:

```
aws s3 rm s3://test-bucket --recursive --exclude="*" --include="data/*.*"

```
```
aws s3 rm s3://bucket/folder1/folder2/ --recursive --dryrun

```

From what I see happening when I try it, adding the slash at the end means delete below folder2, not including folder2.