如何删除大量的命名与S3存储公用preFIX的对象? [英] How to delete lot of objects named with common prefix from s3 bucket?

查看:129
本文介绍了如何删除大量的命名与S3存储公用preFIX的对象?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在S3存储桶的文件,他们的名字具有以下格式:

I have files in s3 bucket, and their names have the following format:

username#file_id#...

如何删除所有约翰#母鹿#*的项目,不上市呢?有成千上万的人,所以当用户请求我的应用程序中删除所有的人,他必须等待。

How to remove all john#doe#* items, without listing them? There are thousands of them, so when user request my app to delete all of them, he has to wait.

推荐答案

有没有办法告诉S3删除符合特定条件的所有文件 - 你必须删除一个关键的时间

There's no way to tell S3 to delete all files that meet a specific criteria - you have to delete one key at a time.

大多数客户端库提供了一种方法来过滤和分页,这样你只列出你需要删除的文件,并可以提供状态更新。举个例子,宝途的斗上市接受preFIX作为参数之一

Most client libraries offer a way to filter and paginate such that you'd only list the files you need to delete and you can provide a status update. For an example, Boto's bucket listing accepts prefix as one of the parameters.

这篇关于如何删除大量的命名与S3存储公用preFIX的对象?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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