SFTP Exists
SFTP Exists
Section titled “SFTP Exists”Type: sftp-exists · Package: SFTP Activities v1.1.0 · Output: bool
Checks whether a file or folder exists on the server and returns true/false. Useful to wait for a file to show up before downloading it, or to avoid overwriting an existing one.
How it works
Section titled “How it works”Looks up remotePath on the server. It returns true whether it is a file or a folder, and false if it does not exist: it does not fail because of a missing path. It changes nothing on the server.
Required parameters
Section titled “Required parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
remotePath | string | — | Remote path to check (file or folder). |
Optional parameters
Section titled “Optional parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
session | ZoanSftpSession | — | Session from SFTP Connect. Inherited inside a body. |
Output
Section titled “Output”Returns a bool: true if the path exists (file or folder), false otherwise.
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: permission denied | The user cannot query the folder that contains the path. |
Example
Section titled “Example”Create the month folder only if it is missing, and download the report if it is already there:
SFTP Exists remotePath = "/inbound/" + today().ToString("yyyy-MM") → output: hasFolderIf condition = !hasFolder └─ then: SFTP Create Directory remotePath = "/inbound/" + today().ToString("yyyy-MM")
SFTP Exists remotePath = "/outbound/report.csv" → output: hasReportIf condition = hasReport └─ then: SFTP Download remotePath = "/outbound/report.csv" localPath = "C:/downloads/report.csv"Related activities
Section titled “Related activities”- SFTP List Directory — list several files.
- SFTP Create Directory — create a folder if it does not exist.