2

As is, SFTP protocol version 3, which is the most widely used version, especially in OpenSSH which implements it uniformly, does not provide folder size information, and this information can only uniformly be obtained by iterating through the files within said folder.

OpenSSH does provide the command, df -h, to get the size of the filesystem on which the folder is hosted, but unless one creates filesystems / logical volumes per folder, this information would not help, also this is a proprietary implementation of OpenSSH. Some clients, like WinSCP do have the means to calculate, from the client side, this information, but again, it is better if implemented within the protocol itself.

SFTP Protocol version 6, does provide the ability to get per folder size information, but it is not widely implemented.

Are there reputed SFTP / SSH servers and clients, with both Windows and Linux implementations, which implement SFTP protocol 6?

6
  • "SFTP Protocol version 6, does provide the ability to get per folder size information" – Do you have a reference for that? Commented Apr 16, 2020 at 13:55
  • Looking at tools.ietf.org/html/draft-ietf-secsh-filexfer-extensions-00, it says - " 'path' for which the available space should be reported. This 'path' is not required to be the mount point path, but MAY be a directory or file contained within the mount." I have a feeling I may have misunderstood device to be a folder, rather than a filesystem or volume.OK, so SFTP v6 does not provide directory / folder size. Is there any way to get this information besides iterating through the folder? Also, conceptually, whose responsibility should it be to calculate this - server or client? Commented Apr 16, 2020 at 15:02
  • That's not anymore a question for this site. Commented Apr 16, 2020 at 15:44
  • Moreover draft-ietf-secsh-filexfer-extensions-00 has nothing to do with SFTP version 6. Those extensions can be implemented by a server of any SFTP version. Commented Apr 16, 2020 at 15:57
  • 1
    That's actually my answer. I've fixed that. Commented Apr 17, 2020 at 5:12

2 Answers 2

2

I do not think that SFTP (any version) supports remote-side calculation of a directory size, anyway...


Servers supporting SFTP-6:

  • Bitvise — It even implements the space-available extension that you refer to (which does not really need SFTP-6 and does not really do what you want) as well as OpenSSH proprietary equivalent [email protected] (what is behind OpenSSH sftp client df command).

  • ProFTPD – It also supports both space-available and [email protected].

While OpenSSH does not support SFTP-6, it (obviously) supports the [email protected].


Clients supporting SFTP-6:

1
  • Thank you for telling me about Bitvise. The issue with statvfs and indeed space-available extension is that they work at device, or volume level, which means, unless there's some other way, iteration through remote directory and adding file size is the only way to get remote directory size. WinSCP .NET library makes it easy, but I wonder why this information is not exposed by any mainstream file sharing protocol. Since the server has the storage space and it has this information, maybe expose it through the protocol. One can always ssh and find out, but that has own complications. Commented Apr 16, 2020 at 18:37
0

In addition to Bitvise and ProFTPD, already mentioned in other replies, you may want to give Syncplify.me Server! a try, it does support SFTP v0 through v6, along with the protocol extensions to compute the size of the current VFS (with multiple VFSs per user). Disclaimer: I am part of the development team at Syncplify.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.