使用 sftp (mtime) 的 stat 命令

stat command using sftp (mtime)

我正在尝试编写一个 bash 脚本,它可以自动查找上传到 ftp 站点的报告。我想在 if 语句中使用 mtime (stat -c %Y <file>) 来测试静态时间参数以进行进一步处理。使用 sftp 时是否有类似的命令? 'stat ' 不起作用,'sftp stat ' 也不起作用,两者都返回 'Invalid Command'。谢谢

使用 OpenSSH sftp,最接近的是

ls -l /remote/path/to/file

如果您有 shell 访问权限,请改用 ssh

ssh user@example.com stat /remote/path/to/file