Checking the file size in an -IF and using it in the action using PowerShell -


i have users have file in dynamic location.

what i'm trying check if file size greater x

i have done research , have code:

$foreach ($user in $users) {     $file = get-item $path            if($file.length -gt 40 )           {                  $file.length / 1gb "is big!"            } } 

i tried playing around 1/gb (using in line of output , in if without result . keeps giving me result in kilobytes.

i tried:

$foreach ($user in $users)     {         $file = get-item $path                if($file.length -gt 40 /1gb )               {                      $file.length / 1gb "is big!"                }     } 

what doing wrong here?

you want divide $file.length 1gb. rather dividing 40 1gb.

foreach ($user in $users){     $file = get-item $path     $sizeingb = $file.length / 1gb     if($sizeingb -gt 40) {         "$sizeingb gb big!"      } } 

Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -