I have a nested "folder"/object structure in my S3 bucket:
myBucket/level1/level2/file1.txt
myBucket/level1/level2/file2.txt
...
Is there any way with aws s3 ls
or aws s3api
to list the size of each "folder"/object on level2?
Thanks!
I have a nested "folder"/object structure in my S3 bucket:
myBucket/level1/level2/file1.txt
myBucket/level1/level2/file2.txt
...
Is there any way with aws s3 ls
or aws s3api
to list the size of each "folder"/object on level2?
Thanks!
You can use the following command:
aws s3 ls s3://myBucket/level1/level2/ --recursive --summarize | awk 'BEGIN{ FS= " "} /Total Size/ {print $3}'
It will print the sum of the sizes, in bytes, of all files under level2
.