6

Is it possible to do stat via sftp cli tool? For example Python's SFTP client has this feature, but I didn't find it in sftp cli tool. I need to get SFTP attributes to work with in script.

user402763
  • 61
  • 1
  • 2

1 Answers1

3

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
Jakuje
  • 9,715
  • 2
  • 42
  • 45
  • I have the same problem A pity the Linux CLI story for SFTP is so poor I cannot do even a simple stat. Here I come Python script. – Paul Draper Nov 09 '21 at 17:43