PowerShell: Sum of selected file sizes

$FilesToDelete = Get-ChildItem -Path "$TopPath\*" -Include *.safe, *.bak, *.trn, *.log -Recurse

($FilesToDelete |Measure-Object -property length -sum).Sum / 1MB

Comments are closed.

Post Navigation