ssh_dir_calc_size
Calculate the total size of a remote directory recursively over SSH by summing regular file sizes, returning bytes and human-readable units.
Instructions
Calculate the total size of a directory recursively: the sum of the sizes of all regular files under it (directories' own sizes are not counted - same on every platform).
On a 'linux' connection whose find lacks -printf (check ssh_conn_connect/
ssh_conn_host_info's capabilities), this raises a clear error instead of running.
Fallback: ssh_cmd_run("du -sk <path>") - kilobytes, and it includes directory
overhead, but works on most BusyBox builds.
Returns:
{'path', 'size_bytes' (int), 'size_human' (e.g. "1.23 MB", "512.00 KB", "3.50 GB" - 2 decimal places, binary/1024-based units)}.
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 | Directory path to calculate size for |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||