检查Amazon S3存储桶中是否存在具有特定前缀的密钥 [英] Check if a key with a certain prefix exists in Amazon S3 bucket
本文介绍了检查Amazon S3存储桶中是否存在具有特定前缀的密钥的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我如何检查是否有一个以前缀"开头的以特定前缀开头的密钥?
How would I check if there's a key that starts with a particular prefix, similar to "folders"?
推荐答案
文档表示,当请求存储桶中的键列表时,可以指定prefix
参数.您可以将max-keys
参数设置为1以提高速度.如果列表不是空的,则说明前缀存在.
The docs say it is possible to specify a prefix
parameter when asking for a list of keys in a bucket. You can set the max-keys
parameter to 1 for speed. If the list is non-empty, you know the prefix exists.
boto的存储桶之类的工具.list()函数也公开了前缀和分页.
Tools like boto's bucket.list() function expose prefixing and paging as well.
这篇关于检查Amazon S3存储桶中是否存在具有特定前缀的密钥的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文