On this publish I’ll present find out how to use PowerShell to calculate the full measurement of all information. This will probably be a brief publish however perhaps a really useful one. Let’s dive in.
Open PowerShell ISE or VS Code. Copy the traces beneath into your PowerShell session and supply the trail of your information.
$filespath="C:Temp"
Get-ChildItem -Path $filespath -File -Recurse |
Choose-Object -ExpandProperty Size |
Measure-Object -Sum
Tip: If you wish to seek for particular information, or exclude some, you should utilize the embrace or exclude parameter. Right here is an instance.
Get-ChildItem -Path "C:UserspatriSynologyDriveVideosUdemy" -File -Exclude *.mp4 -Recurse |
Choose-Object -ExpandProperty Size |
Measure-Object -Sum
The worth of the scale isn’t optimum. That’s the reason you may also show the worth in GB.
Get-ChildItem -Path "C:UserspatriSynologyDriveVideosUdemy" -File -Recurse |
Choose-Object -ExpandProperty Size |
Measure-Object -Sum | Choose-Object @{n='Dimension (GB)';e={$_.Sum/1GB}}
Now you’re a grasp in calculating the scale of information.
Printed by