File system Trigger

File system Trigger

Certified

Trigger on new SFTP files

Polls a remote directory on the interval and starts a Flow when new files appear. Sorted with sort (default NONE) before maxFiles truncation. Defaults: port 22, user home as root, password auth unless a PEM key is provided, host key checking disabled by default. Use action MOVE/DELETE to prevent repeated triggering.

yaml
type: io.kestra.plugin.fs.sftp.Trigger

Wait for one or more files in a given SFTP server's directory and process each of these files sequentially.

yaml
id: sftp_trigger_flow
namespace: company.team

tasks:
  - id: for_each_file
    type: io.kestra.plugin.core.flow.ForEach
    values: "{{ trigger.files }}"
    tasks:
      - id: return
        type: io.kestra.plugin.core.debug.Return
        format: "{{ taskrun.value | jq('.path') }}"

triggers:
  - id: watch
    type: io.kestra.plugin.fs.sftp.Trigger
    host: localhost
    port: 6622
    username: foo
    password: "{{ secret('SFTP_PASSWORD') }}"
    from: "/in/"
    interval: PT10S
    action: MOVE
    moveDirectory: "/archive/"

Wait for one or more files in a given SFTP server's directory and process each of these files sequentially. Delete files manually after processing to prevent infinite triggering.

yaml
id: sftp_trigger_flow
namespace: company.team

tasks:
  - id: for_each_file
    type: io.kestra.plugin.core.flow.ForEach
    values: "{{ trigger.files | jq('.path') }}"
    tasks:
      - id: return
        type: io.kestra.plugin.core.debug.Return
        format: "{{ taskrun.value }}"
      - id: delete
        type: io.kestra.plugin.fs.sftp.Delete
        host: localhost
        port: 6622
        username: foo
        password: "{{ secret('SFTP_PASSWORD') }}"
        uri: "/in/{{ taskrun.value }}"

triggers:
  - id: watch
    type: io.kestra.plugin.fs.sftp.Trigger
    host: localhost
    port: 6622
    username: foo
    password: "{{ secret('SFTP_PASSWORD') }}"
    from: "/in/"
    interval: PT10S
    action: NONE

Wait for one or more files in a given SFTP server's directory and process each of these files sequentially. In this example, we restrict the trigger to only wait for CSV files in the mydir directory.

yaml
id: ftp_wait_for_csv_in_mydir
namespace: company.team

tasks:
  - id: each
    type: io.kestra.plugin.core.flow.ForEach
    values: "{{ trigger.files }}"
    tasks:
      - id: return
        type: io.kestra.plugin.core.debug.Return
        format: "{{ taskrun.value | jq('.path') }}"

triggers:
  - id: watch
    type: io.kestra.plugin.fs.sftp.Trigger
    host: localhost
    port: "6622"
    username: foo
    password: "{{ secret('SFTP_PASSWORD') }}"
    from: "mydir/"
    regExp: ".*.csv"
    action: MOVE
    moveDirectory: "archive/"
    interval: PT10S
    sort: NAME_ASC
Properties
Possible Values
MOVEDELETENONE

Action to perform on retrieved files

MOVE/DELETE remove the file from the watched directory, so the trigger fires on every listed file. NONE leaves the file in place and relies on stateful deduplication (path + size + last-modified) to avoid reprocessing — handle the file in the Flow accordingly.

Directory URI to watch

Remote host

Defaultfalse

Specifies whether a trigger is allowed to start a new execution even if a previous run is still in progress.

Defaultfalse

Enable RSA/SHA1 algorithm

Disabled by default; enable only if the remote server requires it.

DefaultPT1M
Formatduration

Interval between trigger checks

Key exchange algorithm

Override the KEX algorithm (e.g. diffie-hellman-group14-sha1, diffie-hellman-group-exchange-sha256).

SSH private key (PEM)

PEM-formatted private key for public key auth. Convert OpenSSH keys with ssh-keygen -m PEM.

Default25

Maximum files to process per poll

Destination directory when action is MOVE

DefaultCREATE_OR_UPDATE
Possible Values
CREATEUPDATECREATE_OR_UPDATE

Trigger event type

Defines when the trigger fires.

  • CREATE: only for newly discovered entities.
  • UPDATE: only when an already-seen entity changes.
  • CREATE_OR_UPDATE: fires on either event.

Passphrase for the SSH key

Password

Default22

Remote port

SFTP proxy address

SFTP proxy password

SFTP proxy port

SFTP proxy type

One of SOCKS5, STREAM, or HTTP.

SFTP proxy username

Defaultfalse

List files recursively

Regexp filter on full path

Defaulttrue

Treat path as user home root

If true (default), remote paths are resolved relative to the authenticated user's home directory.

DefaultNONE
Possible Values
NONELAST_MODIFIED_ASCLAST_MODIFIED_DESCNAME_ASCNAME_DESC

Sort order applied to pending files before maxFiles truncation

NONE (default) preserves the order in which the server returns files. LAST_MODIFIED_ASC/LAST_MODIFIED_DESC sort by last modified date, oldest/newest first. NAME_ASC/NAME_DESC sort alphabetically by file name.

State key

JSON-type KV key for persisted state. Default: <namespace>__<flowId>__<triggerId>

State TTL

TTL for persisted state entries (e.g., PT24H, P7D).

SubTypestring
Possible Values
CREATEDSUBMITTEDRUNNINGPAUSEDRESTARTEDKILLINGSUCCESSWARNINGFAILEDKILLEDCANCELLEDQUEUEDRETRYINGRETRIEDSKIPPEDBREAKPOINTRESUBMITTED

List of execution states after which a trigger should be stopped (a.k.a. disabled).

Username

Defaulttrue

A condition that determines whether the trigger should run.

A Pebble expression evaluated at trigger time. The trigger fires only when the expression evaluates to a truthy value (true, a non-empty string, a non-zero number). Use this to gate trigger execution on dynamic runtime values such as execution labels, flow variables, or environment conditions.

List of files that triggered the flow, each with its change type

Definitions
changeTypestring
Possible Values
CREATEUPDATE
accessDatestring
Formatdate-time
fileTypestring
Possible Values
FOLDERFILEFILE_OR_FOLDERIMAGINARY
flagsinteger
groupIdinteger
namestring
pathstring
Formaturi
permissionsinteger
sizeinteger
symbolicLinkboolean
Defaultfalse
updatedDatestring
Formatdate-time
userIdinteger