Friday, December 6, 2024
HomePowershellCalculate the full measurement of Recordsdata – SID-500.COM

Calculate the full measurement of Recordsdata – SID-500.COM


PowerShell

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 Patrick Gruenauer

Microsoft MVP on PowerShell [2018-2025], IT-Coach, IT-Marketing consultant, MCSE: Cloud Platform and Infrastructure, Cisco Licensed Academy Teacher.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments