Skip to content

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.

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.

ParameterTypeDefaultDescription
remotePathstring—Remote folder to list.
ParameterTypeDefaultDescription
sessionZoanSftpSession—Session from SFTP Connect. Inherited inside a body.
patternstring—Name pattern, e.g. "*.csv", "report_????.txt". Without a value, everything is returned.

Returns a List<object> where each item is a dictionary with these keys:

KeyTypeContent
namestringFile or folder name.
fullNamestringFull remote path (use it in Download, Move or Delete).
sizenumberSize in bytes.
isDirectorybooltrue if it is a folder.
lastWriteTimestringLast 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.

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: path not foundremotePath does not exist or is not a folder. Check it with SFTP Exists.
Server error: permission deniedThe user cannot read that folder.

Download only the files (not the folders) that match the pattern:

SFTP List Directory remotePath = "/outbound" pattern = "*.csv" → output: files
Log 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"])