AWS S3 - ListObjects 返回不完整的目录列表 [英] AWS S3 - ListObjects returns incomplete directory listings
问题描述
我使用没有任何分隔符的 ListObject
函数,结果我有这样的东西:
/BF/BF/FTP/BF/音乐/图书馆/试听/BEAKING%20EARLY.MP3/BF/视频//BF/视频/示例/BF/视频/示例/test.mp4
问题出在音乐文件夹中.为什么 ListObjects 不返回带有键的 S3Object:/BF/MUSIC".有许多 S3Objects 有同样的问题.为什么会这样?
原因是 S3 实际上具有扁平结构.没有文件夹,但它只识别正斜杠,因此将具有相同前缀的文件夹分组到同一文件夹下.所以在你的例子中/BF/MUSIC"只是另一个对象,而不是一个空文件夹.
<块引用>在 Amazon S3 中,存储桶和对象是主要资源,其中对象存储在桶中.Amazon S3 具有扁平结构,没有层次结构就像您在典型文件系统中看到的那样.然而,对于为了组织简单,Amazon S3 控制台支持文件夹概念作为对对象进行分组的一种方式.亚马逊 S3 做到了这一点通过为对象使用键名前缀.
来源:AWS 文档:使用文件夹>
I use ListObject
function without any delimiters and as result I have something that look like:
/BF
/BF/FTP
/BF/MUSIC/LIBRARY/AUDITION/BEAKING%20EARLY.MP3
/BF/VIDEO/
/BF/VIDEO/Example
/BF/VIDEO/Example/test.mp4
The problem is in the music folder. Why ListObjects doesn't return S3Object with key: "/BF/MUSIC". There are many S3Objects with the same problem. Why is that happening?
The reason is S3 actually has a flat structure. There are no folders but it just recognizes the forward slashes so groups the ones having the same prefix under same folder. So in your example "/BF/MUSIC" would be just another object, not an empty folder.
In Amazon S3, buckets and objects are the primary resources, where objects are stored in buckets. Amazon S3 has a flat structure with no hierarchy like you would see in a typical file system. However, for the sake of organizational simplicity, the Amazon S3 console supports the folder concept as a means of grouping objects. Amazon S3 does this by using key name prefixes for objects.
Source: AWS Documentation: Working with Folders
这篇关于AWS S3 - ListObjects 返回不完整的目录列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!