Hi there,
would be nice to have a Trigger feature when a new file is added into a folder.
Cheers.
For Edge workflows, we do have the File Watch Trigger, which will trigger a workflow whenever the Edge Compute device sees file or directory changes on the configured path. Does this answer your question?
That is great to know, but I mostly need it for the cloud workflows. Basically I would like to trigger specific notebooks each time a new file appears in specific folders.
Would that be possible?
Having a discrete trigger that monitors application files is a great suggestion! I’ll file a ticket and send it over to our development team for evaluation. For the time being, however, there is a workaround.
I believe the best solution would be to build a workflow that uses a Timer Trigger in conjunction with the Losant API Node to query a directory of your application files. I’ve attached an example workflow file that demonstrates this:
application-file-watch-develop.flow (7.3 KB)
Here’s a breakdown of how it works:
-
Timer Trigger - Runs on a set interval (in this example, once per day)
-
Date/Time Node - Formats the time from the payload to UTC time
-
Source Path -
time - Operation - Format
-
Result Format Template -
YYYY-MM-DDTHH:mm:ss.SSS(to match the formatting for application files) - Output Timezone - UTC
-
Result Path -
data.modTime
-
Source Path -
-
Storage: Get Value - Retrieves workflow storage value based on the last time that this workflow was ran (we’ll populate this later)
-
Key -
lastScan - Default Value Type - String Template
-
Default Value -
0
-
Key -
-
Losant API Node - Returns a list of all files in a given application files directory
- Resource and Action - Files: Get
-
directory - (the path to the directory you want to monitor, e.g.
/directoryTwo) -
Payload Path to Store Response -
working.filesAll
-
Loop Node - Loops through the files in the specified directory and determines if there are any that have been updated since the last time this workflow was ran
-
Loop Source Path -
working.filesAll.result.items -
Current Item Path -
working.current - Loop Mode - Run loop iterations serially
-
Loop Source Path -
-
Within the loop…
-
Conditional Node
-
Expression -
{{working.current.value.lastUpdated}} >= {{working.lastScan}}
-
Expression -
-
Array Node
-
Source Array Path -
working.newFiles - Choose an Operation - Push
-
Value Template -
{{working.current.value}} -
Destination Array Path -
working.newFiles
-
Source Array Path -
-
Conditional Node
-
Storage: Set Value - Sets the time the workflow storage value to the formatted time from the payload
- Operation - Store Value from Payload Path
-
Key -
lastScan -
Value -
data.modTime
-
Conditional Node - Evaluates the array created in the Loop node to determine if there are any new files since the last time this workflow was ran. If no, left-side will execute. If yes, right-side will execute.
-
Expression -
{{working.newFiles}}
-
Expression -
In this example, I have Debug Nodes branching from the Conditional Node, but the right-side of that branch could be a Workflow Trigger Node, a Notebook: Execute Node, or a further branch of events you’d like to have take place if there are new files.
Additionally, you’ll have a payload path containing an array of objects with any new file(s) available at working.newFiles.
Please let us know if you have any further questions!
That is an amazing flow, thanks for the effort and explanation.
I have one question, since this potentially (in my case) will be scheduled every 1 minute.
Will that count toward my payload execution counts?
No problem - glad you found it helpful! Yes, all executions of a Timer Trigger in an application workflow count as a payload. See our doc on payloads here.

