Get remote directory size via SFTP

SSHFS uses the SFTP subsystem. This is a FUSE-based solution, get familiar with security concerns. You can (and should) do the mounting as a normal user:

sshfs user@server:some/path /some/local/mountpoint/

Then use du -sh locally. If the path of the directory you want is some/path/foo/directory on the remote system, then you need to use /some/local/mountpoint/foo/directory:

du -sh /some/local/mountpoint/foo/directory

To unmount:

fusermount -u /some/local/mountpoint/

Note: In the above example some/path is a relative path, relative to whatever remote directory SFTP initially uses as ./ for you. The string ./ itself (or . or an empty string) can be used to mount this exact directory. An absolute path can be used as well (e.g. /bar/baz/dir).