我想要做的是,我要检查的大小的子文件夹的特定文件夹中使用VB在亚马逊S3斗一斗。
What i want to do is, i want to check the Size for a sub-folder inside a specific folder for a bucket in Amazon S3 bucket using vb.
这是可能的事情,如果这样任何一个环节,并帮助将appriciated。
Is that possible to do, if so any link and help will be appriciated.
这篇文章的开始使用Amazon S3 是一个很好的起点为您服务。在code位引用的ListObject方法是做99%你想要什么(获得与特定的preFIX所有文件)。你只需要添加位询问每个文件的大小,并把它们加起来。
The article Beginning with Amazon S3 is a good starting point for you. The code bits referencing the listObject method are doing 99% of what you want (getting all files with a particular prefix). You just need to add the bits to interrogate the file size of each and add them up.
如果你能得到桶,那么你已经拥有你所需要的这个片段的工作线了:
If you're able to get the bucket, then you already have all the wire up you need for this snippet to work:
using (s3Client)
{
long totalFileSize = 0;
try
{
ListObjectsRequest Lor = new ListObjectsRequest()
{
BucketName = "<Your Bucket Name>",
Prefix = "<Your Folder Path>",
///assuming your delimiter is a /
Delimiter = "/"
};
ListObjectsResponse response1 = s3Client.ListObjects(Lor);
foreach (S3Object s3Object in response1.S3Objects)
{
totalFileSize += s3Object.Size();
}
}
catch (AmazonS3Exception ex)
{
///do some error handling....
}
}
上一篇:在EC2上的Python uwsgi设置Python、uwsgi
下一篇:亚马逊EC2走秀gzip压缩的JavaScript。但是的Cloudfront没有。为什么?亚马逊、是的、走秀、gzip