how to get folder size which consists of files in

2020-05-09 18:52发布

问题:

lets think we have bucket with name "bucket1" and inside that having a folder with name 'new folder' Inside 'new folder' are files
new folder/a1.pdf-->2mb
new folder/a2.pdf-->2mb
new folder/new folder2/b.pdf-->3mb

when we use amazons3client.listObjects("bucket1","new folder")---->it will return the list of files and folders inside that for each 's3object' there is 'size' parameter i can loop through all those s3 objects and i can get folder size but it is heavy operation.

/* will you please any another way to get folder size*/

回答1:

There is not another way.

The "folder" is not a container in S3 so it has no size, itself.