Total Size (sum) of Items

Ask questions about creating Graphical User Interfaces (GUI) in PowerShell and using WinForms controls.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 4 years and 5 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
dank42
Posts: 61
Last visit: Tue Apr 26, 2022 7:49 am

Total Size (sum) of Items

Post by dank42 »

Having a brain fart here...

Please can someone help me in getting the total in GB from the following
  1. $files = @(Get-S3Object -BucketName "bucketname" -KeyPrefix ".foldername" -ProfileName ProfileName | select size)
An example output for each item without selecting the size property is as follows:

ETag : "c9b3d025ae01a1886aa26e899bdc4b3ffd0"
BucketName : bucketname
Key : .folderpath/images/Win5.png
LastModified : 07/11/2019 08:19:46
Owner :
Size : 6226

The size is in Bytes - I want the total size of all items in GB

Thanks
User avatar
dank42
Posts: 61
Last visit: Tue Apr 26, 2022 7:49 am

Re: Total Size (sum) of Items

Post by dank42 »

Ignore above, I've got what I need
  1. $files | % { $size += $_.Size; $keys++}
This topic is 4 years and 5 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked