
File system Trigger
CertifiedTrigger on new SFTP files
File system Trigger
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.
type: io.kestra.plugin.fs.sftp.TriggerExamples
Wait for one or more files in a given SFTP server's directory and process each of these files sequentially.
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.
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.
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
action *Requiredstring
MOVEDELETENONEAction 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.
from *Requiredstring
Directory URI to watch
host *Requiredstring
Remote host
allowConcurrent Non-dynamicboolean
falseSpecifies whether a trigger is allowed to start a new execution even if a previous run is still in progress.
enableSshRsa1 booleanstring
falseEnable RSA/SHA1 algorithm
Disabled by default; enable only if the remote server requires it.
interval Non-dynamicstring
PT1MdurationInterval between trigger checks
keyExchangeAlgorithm string
Key exchange algorithm
Override the KEX algorithm (e.g. diffie-hellman-group14-sha1, diffie-hellman-group-exchange-sha256).
keyfile string
SSH private key (PEM)
PEM-formatted private key for public key auth. Convert OpenSSH keys with ssh-keygen -m PEM.
maxFiles integerstring
25Maximum files to process per poll
moveDirectory string
Destination directory when action is MOVE
on string
CREATE_OR_UPDATECREATEUPDATECREATE_OR_UPDATETrigger 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 string
Passphrase for the SSH key
password string
Password
port string
22Remote port
proxyAddress string
SFTP proxy address
proxyPassword string
SFTP proxy password
proxyPort string
SFTP proxy port
proxyType string
SFTP proxy type
One of SOCKS5, STREAM, or HTTP.
proxyUsername string
SFTP proxy username
recursive booleanstring
falseList files recursively
regExp string
Regexp filter on full path
rootDir booleanstring
trueTreat path as user home root
If true (default), remote paths are resolved relative to the authenticated user's home directory.
sort string
NONENONELAST_MODIFIED_ASCLAST_MODIFIED_DESCNAME_ASCNAME_DESCSort 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.
stateKey string
State key
JSON-type KV key for persisted state.
Default: <namespace>__<flowId>__<triggerId>
stateTtl string
State TTL
TTL for persisted state entries (e.g., PT24H, P7D).
stopAfter Non-dynamicarray
CREATEDSUBMITTEDRUNNINGPAUSEDRESTARTEDKILLINGSUCCESSWARNINGFAILEDKILLEDCANCELLEDQUEUEDRETRYINGRETRIEDSKIPPEDBREAKPOINTRESUBMITTEDList of execution states after which a trigger should be stopped (a.k.a. disabled).
username string
Username
when string
trueA 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.
Outputs
files array
List of files that triggered the flow, each with its change type
io.kestra.plugin.fs.vfs.Trigger-TriggeredFile
CREATEUPDATEdate-timeFOLDERFILEFILE_OR_FOLDERIMAGINARYurifalsedate-time