0

I have a posh-ssh setup that seems to be working pretty well. I'm looking to get the size of a file.

https://github.com/darkoperator/Posh-SSH/blob/master/docs/Get-SFTPContent.md

I feel like I should be able to do something like Get-SFTPContent.length -byte or something and return JUST the length but I can't find the documentation on exactly how to do this.

The challenge is I don't want to return the whole 600mb file as a bytearray. That would be bad.

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
Daniel Williams
  • 167
  • 1
  • 10

1 Answers1

0

You can run

Get-SFTPChildItem -SessionId <id> | select FullName, Length

to get a list of file names and sizes in your current directory.

Or if you prefer the output shown in kilobytes:

Get-SFTPChildItem -SessionId <id> | select FullName, @{N='Size (kB)';E={$_.Length/1kb}}
kim
  • 3,385
  • 2
  • 15
  • 21