I am using Renci.SshNet (SSH.NET) library to upload files on SFTP server. Before uploading a file I want to check size of available hard drive. I am using this code.
ssf = New SftpClient("ip", "port", "user", "password")
ssf.Connect()
Dim fpath As String = "/"
Dim res = ssf.GetStatus(fpath)
I am getting total, free and available nodes and blocks. But unable how to find available hard drive by this method. Or is there any other way to do it?
Use the SftpFileSytemInformation.BlockSize
field to convert blocks to bytes.
E.g.
freeBytes = res.FreeBlocks * res.BlockSize
See also section Extension requests "statvfs@openssh.com" and "fstatvfs@openssh.com" in:
https://github.com/openssh/openssh-portable/blob/master/PROTOCOL