SFTP Close
SFTP Close
Section titled “SFTP Close”Type: sftp-close · Package: SFTP Activities v1.1.0
Closes an SFTP session and releases the connection. Needed when you open the session with SFTP Connect without body.
How it works
Section titled “How it works”Disconnects from the server and releases the given session. After this, the session can no longer be used: activities that receive it will fail. Do not use it inside the SFTP Connect body: there the connection already closes by itself on exit, and closing it earlier makes that final close fail.
Required parameters
Section titled “Required parameters”None.
Optional parameters
Section titled “Optional parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
session | ZoanSftpSession | — | The session returned by SFTP Connect. If omitted, the inherited session is used, if any. |
Output
Section titled “Output”This activity does not return a value.
Common errors
Section titled “Common errors”| Message | Cause and fix |
|---|---|
'session' must be a ZoanSftpSession. | No valid session was passed and none is inherited. Pass the variable returned by SFTP Connect (session = sftp). |
Example
Section titled “Example”Guarantee the close even if the upload fails:
SFTP Connect host = "sftp.vendor.com" username = "zoan" password = credential("sftp-vendor")["password"] → output: sftpTry / Catch errorVariable = error ├─ try: │ SFTP Upload session = sftp localPath = file remotePath = "/inbound/data.csv" ├─ catch: │ Log level = error message = "Upload failed: " + error.Message └─ finally: SFTP Close session = sftpRelated activities
Section titled “Related activities”- SFTP Connect — open the connection.