I'm using Renci SSH.NET library for secure ftp connection. Now I have to check free disk space available on remote SFTP server. How can I do this?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
As Eugene commented, SFTP protocol version 6 lets one check available space (SSH_FXP_EXTENDED
request name space-available
).
But Renci SSH.NET library supports SFTP protocol version 3 only. Also worth noting that most SSH/SFTP servers (notably OpenSSH, as the one the most widespread) support SFTP version 3 only too. So client-side support won't help much here.
As Salva has commented, OpenSSH on the other hand supports statvfs@openssh.com
proprietary extension. And Renci SSH.NET library supports that too (via SftpClient.GetStatus
). So if you are sure that you work against OpenSSH server, you can use that.