Skip to content

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.

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.

ParameterTypeDefaultDescription
remotePathstring—Remote path to check (file or folder).
ParameterTypeDefaultDescription
sessionZoanSftpSession—Session from SFTP Connect. Inherited inside a body.

Returns a bool: true if the path exists (file or folder), false otherwise.

MessageCause 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 deniedThe user cannot query the folder that contains the path.

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: hasFolder
If condition = !hasFolder
└─ then:
SFTP Create Directory remotePath = "/inbound/" + today().ToString("yyyy-MM")
SFTP Exists remotePath = "/outbound/report.csv" → output: hasReport
If condition = hasReport
└─ then:
SFTP Download remotePath = "/outbound/report.csv" localPath = "C:/downloads/report.csv"