问题描述
S3Client.ListObjects只返回对象1000。如何检索所有现有对象列表使用亚马逊的C#库?
S3Client.ListObjects return only 1000 of objects. How to retrieve list of all existing objects using Amazon C# library?
推荐答案
如前所述已,亚马逊S3 中确实需要上市键使用AWS SDK的.NET :
As stated already, Amazon S3 indeed requires Listing Keys Using the AWS SDK for .NET:
如水桶可含有几乎无限数量的键,所述的 清单查询的完整结果可能会非常大。去管理 大结果集,Amazon S3使用分页它们分割成 多个响应。每个列表按键响应返回最多的页面 1000按键与指示灯,指示响应将被截断。 你送了一系列的列表项的请求,直到你接收到的所有 的键。
所提到的指标是NextMarker从ObjectsResponse类 - 它的使用说明在完整的例子Listing按键使用AWS SDK的.NET ,相关片段的存在:
The mentioned indicator is the NextMarker property from the ObjectsResponse Class - its usage is illustrated in the complete example Listing Keys Using the AWS SDK for .NET, with the relevant fragment being:
static AmazonS3 client;
client = Amazon.AWSClientFactory.CreateAmazonS3Client(
accessKeyID, secretAccessKeyID);
ListObjectsRequest request = new ListObjectsRequest();
request.BucketName = bucketName;
do
{
ListObjectsResponse response = client.ListObjects(request);
// Process response.
// ...
// If response is truncated, set the marker to get the next
// set of keys.
if (response.IsTruncated)
{
request.Marker = response.NextMarker;
}
else
{
request = null;
}
} while (request != null);
这篇关于如何列出亚马逊S3存储桶_all_对象?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!