0

I have a file having data around 5GB. I tried to get size of the file using get-content $path2 | Measure-Object method. But its taking more time as Get-Content cmdlet is present.

Is there method to get the size of this kind of file very quickly. I would like to get the file size using Properties of a file using Get-ItemProperty.

Can anyone suggest me on this?

slava
  • 161
  • 2
  • 11
Dinesh
  • 1

1 Answers1

1

Is there a reason why you MUST use get-itemproperty?

in that case I guess I would write: get-itemproperty .\filename.txt -name length

...and then parse the output or pipe it.

.

A better choice would be to use the

get-childitem command and parse the output from that. Something like:

get-childitem .\filename.txt | select length

...but this gives you an extra line that you don't want, so refine it with

get-childitem .\filename.txt | % ( $_.length )

yeah, that looks better.

Larryc
  • 315
  • 1
  • 5