SFTP - check free space available

2019-05-31 19:16发布

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条回答
来,给爷笑一个
2楼-- · 2019-05-31 19:26

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.

查看更多
登录 后发表回答