ssh_file_stat
Get status information for a remote file or directory via SFTP, returning existence, type, size, and timestamps without shell commands.
Instructions
Get status information about a file or directory (via SFTP stat - works the same way on all platforms, no shell command involved).
On Windows, mode/uid/gid come from the SFTP subsystem's own cross-platform
attribute reporting, not real Windows ACLs/ownership - Windows has no equivalent
concept, so these values (e.g. uid/gid of 0) are not meaningful there and
should not be relied on to reason about actual Windows permissions/ownership.
type/size/atime/mtime are unaffected and accurate on all platforms.
Returns:
{'exists': True, 'path', 'type' ('file'/'directory'/'symlink'/'unknown'), 'mode' (octal string, e.g. "0o40755"), 'uid', 'gid', 'size' (bytes), 'atime', 'mtime'} when the path exists. atime/mtime are raw numeric Unix
timestamps (seconds since epoch, as returned by SFTP), not formatted date
strings - convert with datetime.fromtimestamp() if you need a readable date.
If the path does NOT exist (or stat failed for another reason, e.g.
permission denied), returns {'exists': False, 'path', 'error'} instead -
this is a normal, non-exceptional return value, not a raised error. If the check
itself fails (permission denied, no SFTP on this host, ...), exists is None
(unknown), not False, with the reason in error.
Long-running calls: if this takes longer than the server's wait cap (default 50s), it
returns {"status": "in_progress", "handle_id": ...} instead of the result - the work keeps
running. Get the result by polling ssh_cmd_check_status(handle_id=...), which returns this
tool's normal response once finished. Do not call it again meanwhile. Only one such
operation runs at a time; another one started meanwhile fails with a 'busy' error.Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | File or directory path to get information about |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||