[英]Windows PowerShell Posh-SSH module script SFTP file-upload to Linux server giving error
[英]Get the Size of a File on SFTP Server using Posh-SSH
我有一個看起來運行良好的豪華 ssh 設置。 我正在尋找文件的大小。
https://github.com/darkoperator/Posh-SSH/blob/master/docs/Get-SFTPContent.md
我覺得我應該能夠做一些像 Get-SFTPContent.length -byte 之類的事情並只返回長度,但我找不到關於如何做到這一點的文檔。
挑戰是我不想將整個 600mb 文件作為字節數組返回。 那會很糟糕。
你可以跑
Get-SFTPChildItem -SessionId <id> | select FullName, Length
獲取當前目錄中的文件名和大小列表。
或者,如果您更喜歡以千字節顯示的輸出:
Get-SFTPChildItem -SessionId <id> | select FullName, @{N='Size (kB)';E={$_.Length/1kb}}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.