从 S3 存储桶中的文件夹中删除文件 [英] Delete files from folder in S3 bucket

查看:49
本文介绍了从 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/*.*"

这篇关于从 S3 存储桶中的文件夹中删除文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆