ssh_dir_search_glob
Recursively find remote files or directories matching a filename glob pattern over SSH, so you can locate paths by name without searching file contents.
Instructions
Recursively search for files (or directories, with include_dirs=True) matching
a filename glob pattern (e.g. *.log) - matches by NAME only, not content; use
ssh_dir_search_files_content instead to search inside files. For metadata beyond
just path/type (size, mtime, permissions), use ssh_dir_list_advanced instead.
max_depth uses standard find -maxdepth semantics: this is the same on both
Linux/macOS and Windows despite the different underlying commands. max_depth=1
means the given path itself plus its immediate children only (not
grandchildren); omit max_depth for unlimited recursion.
On a 'linux'/'flex' connection with a limited BusyBox-style find (no
-printf - check ssh_conn_connect/ssh_conn_host_info's capabilities),
this raises a clear error instead of running. Fallback: ssh_dir_list_files_basic
(non-recursive filenames, match the pattern yourself) - SFTP-based and
unaffected by this, at the cost of one call per directory level.
Returns:
List of {'path': str, 'type': str} - type is a single-character code
(f=file, d=directory, l=symlink) from the underlying find/stat
output, not a spelled-out word.
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 | Base directory to search from | |
| pattern | Yes | Filename glob pattern (e.g. *.log) | |
| use_sudo | No | Use sudo for the operation | |
| max_depth | No | Maximum recursion depth (None for unlimited) | |
| include_dirs | No | Include matching directories in results |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |