Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Powershell - Get size of files listed in an array

$
0
0

Hi there! I'm a newbie in powershell. As you can see, maybe my problem is kinda easy but i'm getting nuts over here.

I got this object, that is an array

PS C:\scripts\CleanScan> $gotFiles.GetType()

IsPublic IsSerial Name                                     BaseType                                                                                                             
-------- -------- ----                                     --------                                                                                                             
True     True     Object[]                                 System.Array  

It came from an query gci

$gotFiles = Get-ChildItem -Path $path -Recurse | Where-Object {$_.CreationTime -lt $limit}

It gets the files in a directory older than $limit 

Then my problem: Need to get the size in KB of each item in the array.

Any help would be appreciated.


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>