在Amazon S3上的特定文件夹对象列表 [英] List objects in a specific folder on Amazon S3

查看:186
本文介绍了在Amazon S3上的特定文件夹对象列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想获得的对象列表下的特定文件夹在我的水桶。

I am trying to get the list of Object under a specific folder in my bucket.

我知道,让我的所有对象的列表,我做的:

I know that to get a list of all of my objects I do:

    $objects = $client->getIterator('ListObjects', array(
    'Bucket' => $bucket
)); 

我想获得的文件夹我的/文件夹/测试下只对象。我曾尝试添加

I want to get only the objects under the folder my/folder/test. I have tried adding

        'key' => "my/folder/test",

        'prefix' => "my/folder/test",

但它只是返回我的桶的所有对象。

But it simply returns all of the objects in my bucket.

推荐答案

您需要使用 preFIX 来限制搜索到指定目录(一种常见的preFIX)。

You need to use Prefix to restrict the search to a specific directory (a common prefix).

$objects = $client->getIterator('ListObjects', array(
    "Bucket" => $bucket,
    "Prefix" => "your-folder/"
)); 

这篇关于在Amazon S3上的特定文件夹对象列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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