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
Linux implementations, which implement
SFTP protocol 6?