PowerShell Script to Get a Directory Total Size

I require to get the dimension of a directory site, recursively. I need to do this on a monthly basis approximately. I intend to make a powershell manuscript to do it.

2019-05-04 16:37:58
Source Share
Answers: 2

I asked the very same inquiry in stackoverflow and also I get this superb solution:

function Get-DirectorySize() {
  param ([string]$root = $(resolve-path .))
  gci -re $root |
    ?{ -not $_.PSIsContainer } | 
    measure-object -sum -property Length

This in fact generates a little a recap object which will certainly include the matter of things. You can simply order the Sum building though which will certainly be the amount of the sizes.

$sum = (Get-DirectorySize "Some\File\Path").Sum

Thanks to JaredPad for the solution.

2019-05-12 11:31:27

Check this post out.

2019-05-08 02:32:58