SFTP List Directory
SFTP List Directory
Section titled “SFTP List Directory”Type: sftp-list · Package: SFTP Activities v1.1.0 · Output: List<object>
Lists the files and folders of a remote path. It is the basis of processes that collect files: see what is available on the server to download and process it.
How it works
Section titled “How it works”Lists the direct content of remotePath (it does not go into subfolders) and, if you set pattern, keeps the names that match it. The special entries . and .. are skipped. The result includes files and folders: use isDirectory to tell them apart.
The pattern supports * (any text) and ? (one character), is matched against the whole name and is case-insensitive: *.csv finds data.CSV.
Required parameters
Section titled “Required parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
remotePath | string | — | Remote folder to list. |
Optional parameters
Section titled “Optional parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
session | ZoanSftpSession | — | Session from SFTP Connect. Inherited inside a body. |
pattern | string | — | Name pattern, e.g. "*.csv", "report_????.txt". Without a value, everything is returned. |
Output
Section titled “Output”Returns a List<object> where each item is a dictionary with these keys:
| Key | Type | Content |
|---|---|---|
name | string | File or folder name. |
fullName | string | Full remote path (use it in Download, Move or Delete). |
size | number | Size in bytes. |
isDirectory | bool | true if it is a folder. |
lastWriteTime | string | Last modification date in ISO 8601 format (e.g. "2026-10-15T08:30:00.0000000-05:00"). |
The order is the one the server returns (not necessarily alphabetical). If the folder is empty or nothing matches the pattern, it returns an empty list.
Common errors
Section titled “Common errors”| Message | Cause and fix |
|---|---|
'remotePath' is required. | The parameter is missing or the expression returned null. |
'session' must be a ZoanSftpSession. | The activity is outside the SFTP Connect body and received no session. |
| Server error: path not found | remotePath does not exist or is not a folder. Check it with SFTP Exists. |
| Server error: permission denied | The user cannot read that folder. |
Example
Section titled “Example”Download only the files (not the folders) that match the pattern:
SFTP List Directory remotePath = "/outbound" pattern = "*.csv" → output: filesLog message = "Files available: " + count(files)For Each items = files itemVariable = item └─ activities: If condition = !(bool)item["isDirectory"] └─ then: SFTP Download remotePath = item["fullName"] localPath = pathJoin("C:/downloads", item["name"])Related activities
Section titled “Related activities”- SFTP Download — download each listed file.
- SFTP Exists — check a specific file.