sftp How to get stat attributes?

Solution 1:

The sftp tool in OpenSSH does not have stat command (otherwise it would be listed in the manual page as supported commands). But the protocol itself is using stat to retrieve the information about remote files (for ls mostly). So to the answer:

  • No, there is no possibility to get raw stat data from sftp cli (only what you can get from ls, ls -l and so)
  • At best, you should try to write a script in python