Click here to Skip to main content
15,889,931 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello Fellow Developers

I am here again,
this time i want to check the Size for a folder inside a specific bucket in Amazon S3 bucket using vb.

Is that possible to do, if so any link and help will be appriciated.

thanks and regards
Ram
Posted
Comments
IncredibleRam 28-Mar-12 2:08am    
might got the answer with the help of frndz i think: (This might be the way to do that)

Public Shared Sub CheckUserFolderSize(ByVal s3Client As AmazonS3, ByVal bucketName As String, ByVal folderName As String)

Try
Using (s3Client)

Dim totalFileSize As Long
Dim maxSize As Long = 1.0
'assuming your delimiter is a /
Dim Lor As New ListObjectsRequest() With { _
.BucketName = bucketName, _
.Prefix = folderName, _
.Delimiter = "/" _
}

Dim response1 As ListObjectsResponse = s3Client.ListObjects(Lor)

For Each s3Object As S3Object In response1.S3Objects
totalFileSize += s3Object.Size()
Next

If totalFileSize > maxSize Then

End If
End Using
Catch ex As Exception

End Try

End Sub

here Folder name is the prefix, as we don't have the directory structure in the Amazon S3.
Thanks and Regards.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900