
File system Trigger
CertifiedTrigger on new SMB files
File system Trigger
Trigger on new SMB files
Polls a share path on the interval and starts a Flow when new files appear. Sorted with sort (default NONE) before maxFiles truncation. Default port 445. Use action MOVE/DELETE to avoid reprocessing.
type: io.kestra.plugin.fs.smb.TriggerExamples
Wait for one or more files in a given SMB server's directory and process each of these files sequentially. Then move them to another share which is used as an archive.
id: smb_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.smb.Trigger
host: localhost
port: "445"
username: foo
password: "{{ secret('SMB_PASSWORD') }}"
from: "/my_share/in/"
interval: PT10S
action: MOVE
moveDirectory: "/archive_share/"
Wait for one or more files in a given SMB server's directory and process each of these files sequentially. Then move them to another share which is used as an archive.
id: smb_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') }}"
- id: delete
type: io.kestra.plugin.fs.smb.Delete
host: localhost
port: "445"
username: foo
password: "{{ secret('SMB_PASSWORD') }}"
uri: "/my_share/in/{{ taskrun.value | jq('.path') }}"
triggers:
- id: watch
type: io.kestra.plugin.fs.smb.Trigger
host: localhost
port: "445"
username: foo
password: "{{ secret('SMB_PASSWORD') }}"
from: "/my_share/in/"
interval: PT10S
action: NONE
Wait for one or more files in a given SMB server's directory (composed of share name followed by dir path) 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: smb_wait_for_csv_in_my_share_my_dir
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.smb.Trigger
host: localhost
port: "445"
username: foo
password: "{{ secret('SMB_PASSWORD') }}"
from: "my_share/mydir/"
regExp: ".*.csv"
action: MOVE
moveDirectory: "my_share/archivedir"
interval: PT10S
sort: NAME_ASC
Properties
action *Requiredstring
MOVEDELETENONEAction to perform on retrieved files
If NONE, handle files in the Flow to avoid reprocessing.
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.
interval Non-dynamicstring
PT1MdurationInterval between trigger checks
maxFiles integerstring
25Maximum files to process per poll
moveDirectory string
Destination directory when action is MOVE
on string
CREATE_OR_UPDATECREATEUPDATECREATE_OR_UPDATEChange event type to react to
password string
Password
port string
445Remote port
recursive booleanstring
falseList files recursively
regExp string
Regexp filter on full path
sort string
NONENONELAST_MODIFIED_ASCLAST_MODIFIED_DESCNAME_ASCNAME_DESCSort order applied to pending files before maxFiles truncation
NONE (default) preserves the order returned by the share listing. 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
Custom state key for deduplication
stateTtl string
TTL for state entries
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.smb.Trigger-TriggeredFile
CREATEUPDATEdate-timeFOLDERFILEFILE_OR_FOLDERIMAGINARYurifalsedate-time