我正在使用boto
和Python
来存储和检索文件以及从Amazon S3
。 我需要获取directory
中存在的文件列表。我知道有没有,所以我措辞像how can I get a list of all file names having same prefix?
如何获得在Amazon S3上具有相同前缀的所有文件名的列表?
我的问题对于示例 - 比方说,我有如下文件 -
Brad/files/pdf/abc.pdf
Brad/files/pdf/abc2.pdf
Brad/files/pdf/abc3.pdf
Brad/files/pdf/abc4.pdf
mybucket/files/pdf/new/
mybucket/files/pdf/new/abc.pdf
mybucket/files/pdf/2011/
当我打电话foo("Brad")
在S3目录的概念,它应该返回像一个列表这 -
files/pdf/abc.pdf
files/pdf/abc2.pdf
files/pdf/abc3.pdf
files/pdf/abc4.pdf
这样做的最佳方法是什么?
工作。 此外,如果list'paths'太大,你会建议使用上述哪种方法? – Heisenberg
我更喜欢第一个。 – user3