> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.meetgail.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.meetgail.com/_mcp/server.

# SFTP List Directory

> Lists the files and folders in a directory on a remote SFTP server, with optional filters and sorting.

The List Directory node looks inside a directory on a remote SFTP server and hands
back the files and folders it finds, with optional filters on name and date. It is
the starting point for any workflow that picks files up off a server.

## When to use it

* You want to see what files are waiting in a directory before downloading them.
* You need only files that match a pattern, such as `*.csv`, or a date window.
* You want to loop over the results and download each file in turn.

## Inputs

| Field           | What it's for                                                    | Example                                                         |
| --------------- | ---------------------------------------------------------------- | --------------------------------------------------------------- |
| Server          | The SFTP server to connect to.                                   | `sftp.example.com`                                              |
| Port            | The server's port, usually 22.                                   | `22`                                                            |
| Username        | The username to sign in with.                                    | `automation-user`                                               |
| Password or key | The password or private key to sign in with, stored as a secret. | A [Secret](/platform/workflows/core-concepts/secrets) reference |
| Directory       | The directory to list.                                           | `/outbound/reports`                                             |
| Name pattern    | Only return files whose name matches this pattern.               | `*.csv`                                                         |
| Modified after  | Only return files changed after this date and time.              | `2026-01-01`                                                    |
| Modified before | Only return files changed before this date and time.             | `2026-02-01`                                                    |
| Include folders | Whether to include subfolders in the results.                    | `false`                                                         |
| Sort by         | Which field to order the results on: name, modified, or size.    | `modified`                                                      |
| Max results     | The most entries to return.                                      | `10`                                                            |

The password or key must reference a workflow [Secret](/platform/workflows/core-concepts/secrets).
Any field can be a fixed value or an [expression](/platform/workflows/core-concepts/expressions/using-expressions-in-nodes)
that reads from an earlier step.

## Outputs

| Field         | What you get back                                                                                                 |
| ------------- | ----------------------------------------------------------------------------------------------------------------- |
| Entries       | The files and folders found, each with its name, full path, size, whether it is a folder, and last-modified time. |
| Total matched | How many entries matched the filters before the limit was applied.                                                |
| Count         | How many entries were returned.                                                                                   |

## Example

A carrier drops daily CSV reports onto an SFTP server for Chen Insurance Group. A
workflow uses List Directory to find the `*.csv` files in `/outbound/reports`
sorted newest first, then loops over the results with a
[For Each](/platform/workflows/node-reference/logic-and-flow/for-each) step to download and
process each report.

![The SFTP List Directory node configuration panel, showing the server, directory, and filters.](https://fdr-prod-docs-files-public.s3.us-east-1.amazonaws.com/gail.docs.buildwithfern.com/bf72488156af82c202fb98eb33c7860fcac6f3921aa776407dbdc816a80b25c2/docs/pages/platform/workflows/assets/sftp-list-directory.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=AKIA6KXJSKKNFOCF7G4B%2F20260823%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20260823T232932Z&X-Amz-Expires=604800&X-Amz-Signature=2778a06be6c34a6e32a59a21417965fb32824308e22ef5f5caf462972d7537db&X-Amz-SignedHeaders=host&x-amz-checksum-mode=ENABLED&x-id=GetObject)

The password or private key must be stored as a workflow
[Secret](/platform/workflows/core-concepts/secrets) and referenced from the node - a
plain-text credential is rejected when you publish. Provide whichever one your
server accepts.

## Related nodes

#### [Download](/platform/workflows/node-reference/integrations/sftp/sftp-download)

Pull one of the listed files into the run.

#### [For Each](/platform/workflows/node-reference/logic-and-flow/for-each)

Loop over the returned entries and act on each file.

#### [Upload](/platform/workflows/node-reference/integrations/sftp/sftp-upload)

Push a file back to the server.

#### [Check](/platform/workflows/node-reference/logic-and-flow/check)

Branch on whether the listing succeeded.