Question

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?

Was it helpful?

Solution

As Eugene commented, SFTP protocol actually have an API to check available space (SSH_FXP_EXTENDED request name space-available defined in draft-ietf-secsh-filexfer-extensions-00).

But Renci SSH.NET library does not support the extension. Also worth noting that most SSH/SFTP servers (notably OpenSSH, as the one the most widespread) do not support this extension either. So client-side support won't help much here.

As Salva has commented, OpenSSH on the other hand supports statvfs@openssh.com proprietary extension with very similar functionality as space-available. 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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top