从 S3 存储桶中的文件夹中删除文件

问题描述:

我有一个带有 data 文件夹的 AWS S3 存储桶 test-bucket.数据文件夹将有多个文件.

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

我可以删除 S3 存储桶中的文件.但我想要的是删除data文件夹中的文件而不删除文件夹.

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.

我尝试了以下方法:

aws s3 rm  s3://test-bucket/data/*

还使用 --recursive 选项进行了检查,但这不起作用.

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

是否可以使用 AWS CLI 删除文件夹中的文件?

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

以下 aws cli 命令有效:

Following aws cli command worked:

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