# File created trigger

**URL:** <https://forums.losant.com/t/file-created-trigger/4920>\
**Category:** Feature Request\
**Tags:** workflow\
**Created:** [February 4, 2023, 8:37am UTC](https://forums.losant.com/t/file-created-trigger/4920 "2023-02-04T08:37:25Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Paolo\_Proxy](https://avatars.discourse-cdn.com/v4/letter/p/b5ac83/32.png) [@Paolo\_Proxy](https://forums.losant.com/u/Paolo_Proxy)\
**Post date:** [February 4, 2023, 8:37am UTC](https://forums.losant.com/t/file-created-trigger/4920/1 "2023-02-04T08:37:25Z")

</div>

Hi there,  
would be nice to have a Trigger feature when a new file is added into a folder.  
Cheers.

---

<div class="post-metadata">

**Author:** ![Sebastian\_Turner](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/sebastian_turner/32/4024_2.png) [@Sebastian\_Turner](https://forums.losant.com/u/Sebastian_Turner)\
**Post date:** [February 6, 2023, 2:59pm UTC](https://forums.losant.com/t/file-created-trigger/4920/2 "2023-02-06T14:59:46Z")

</div>

For [Edge workflows](https://docs.losant.com/workflows/edge-workflows/), we do have the [File Watch Trigger](https://docs.losant.com/workflows/triggers/file-watch/), which will trigger a workflow whenever the [Edge Compute device](https://docs.losant.com/devices/edge-compute/) sees file or directory changes on the configured path. Does this answer your question?

---

<div class="post-metadata">

**Author:** ![Paolo\_Proxy](https://avatars.discourse-cdn.com/v4/letter/p/b5ac83/32.png) [@Paolo\_Proxy](https://forums.losant.com/u/Paolo_Proxy)\
**Post date:** [February 6, 2023, 3:11pm UTC](https://forums.losant.com/t/file-created-trigger/4920/3 "2023-02-06T15:11:28Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Sebastian\_Turner](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/sebastian_turner/32/4024_2.png) [@Sebastian\_Turner](https://forums.losant.com/u/Sebastian_Turner)\
**Post date:** [February 7, 2023, 12:55am UTC](https://forums.losant.com/t/file-created-trigger/4920/5 "2023-02-07T00:55:06Z")

</div>

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](https://forums.losant.com/uploads/short-url/cGBJs0GWlVmPGRuzqqaevPad2Eu.flow) (7.3 KB)

Here’s a breakdown of how it works:

 ![Screen Shot 2023-02-06 at 19.44.24](https://us1.discourse-cdn.com/flex015/uploads/getstructure/original/2X/3/33c241a3a8dd33087191e0caf1c7edd9df00463f.png)

- [Timer Trigger](https://docs.losant.com/workflows/triggers/timer/) - Runs on a set interval (in this example, once per day)

- [Date/Time Node](https://docs.losant.com/workflows/logic/date-time/) - Formats the time from the payload to UTC time

- [Storage: Get Value](https://docs.losant.com/workflows/data/get-value/) - Retrieves workflow storage value based on the last time that this workflow was ran (we’ll populate this later)

- [Losant API Node](https://docs.losant.com/workflows/data/losant-api/) - Returns a list of all files in a given application files directory

- [Loop Node](https://docs.losant.com/workflows/logic/loop/) - 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

 ![Screen Shot 2023-02-06 at 19.44.41](https://us1.discourse-cdn.com/flex015/uploads/getstructure/original/2X/9/969bf89cba6072bfe0e4da2b0c545555ea769917.png)

- Within the loop…

- [Storage: Set Value](https://docs.losant.com/workflows/data/store-value/) - Sets the time the workflow storage value to the formatted time from the payload

- [Conditional Node](https://docs.losant.com/workflows/logic/conditional/) - 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.

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](https://docs.losant.com/workflows/outputs/workflow-trigger/), a [Notebook: Execute Node](https://docs.losant.com/workflows/outputs/notebook-execute/), 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!

---

<div class="post-metadata">

**Author:** ![Paolo\_Proxy](https://avatars.discourse-cdn.com/v4/letter/p/b5ac83/32.png) [@Paolo\_Proxy](https://forums.losant.com/u/Paolo_Proxy)\
**Post date:** [February 14, 2023, 7:48pm UTC](https://forums.losant.com/t/file-created-trigger/4920/6 "2023-02-14T19:48:06Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Sebastian\_Turner](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/sebastian_turner/32/4024_2.png) [@Sebastian\_Turner](https://forums.losant.com/u/Sebastian_Turner)\
**Post date:** [February 14, 2023, 7:56pm UTC](https://forums.losant.com/t/file-created-trigger/4920/7 "2023-02-14T19:56:45Z")

</div>

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](https://docs.losant.com/organizations/resource-limits/#payload-types).
