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.
Post Reply
User avatar
dank42
Posts: 61
Joined: Mon Apr 25, 2016 1:08 am
Location: United Kingdom

Total Size (sum) of Items

Post by dank42 » Fri Nov 08, 2019 2:19 am

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
Joined: Mon Apr 25, 2016 1:08 am
Location: United Kingdom

Re: Total Size (sum) of Items

Post by dank42 » Fri Nov 08, 2019 2:52 am

Ignore above, I've got what I need
  1. $files | % { $size += $_.Size; $keys++}

Post Reply