I just would like some help removing the @{}
characters from my output
My script is to get the folder sizes from a specific Drive or Directory
Here is my script
$HugeFileSizeFolder= @() -join ','
$folder = "E:\New Folder\"
Get-ChildItem -Recurse $folder | Where-Object { $_.PSIsContainer } |
ForEach-Object {
$obj = New-Object PSObject
$Size = [Math]::Round((Get-ChildItem -Recurse $_.FullName | Measure-Object Length -Sum -ErrorAction SilentlyContinue).sum / 1000MB, 2)
$obj | Add-Member -MemberType NoteProperty -Name "Path" $_.FullName
$obj | Add-Member -MemberType NoteProperty -Name "SizeGB" $Size
if ($Size -ge 2)
{
$HugeFileSizeFolder +=$obj
}
}
$HugeFileSizeFolder | Out-string
$HugeFileSizeFolderFound = [boolean] $HugeFileSizeFolder
Here is a sample output
@{Path=E:\New Folder\Folder1; SizeGB=3.4GB}
I've tried the suggested tweaks but somehow I cannot get it to work ok maybe I'm not doing it right.
Your input and suggestions are very much appreciated
thanks Newbie