how does file observer trigger exactly work?

Post your questions and help other users.

Moderator: Martin

Post Reply
User avatar
Posts: 154
Joined: 12 Jan 2019 11:53
Location: Vignola, Mo, Italy

how does file observer trigger exactly work?

Post by tsolignani » 25 Mar 2020 23:25

Good night everyone.

I have a couple of questions regarding that trigger.

Say I have more than one files that raise the trigger into a directory. What happens then? Does the flow with the file observer trigger cycle for each of those files, executing as many times as there are files?

Can I use jolly characters into the path definition? Say I want the trigger to raise when a new subfile is created into a certain folder, but only if the extension is PDF. Can I use the *.PDF syntax or should I let the trigger raise everytime and just put a condition afterward.

And can I use a global variable to define the watched path and call the flow with the trigger with the action execute flow?

Thank you.

User avatar
Posts: 2478
Joined: 21 Jul 2017 17:50

Re: how does file observer trigger exactly work?

Post by Desmanto » 26 Mar 2020 17:48

I rarely use that. Everytime I try to use that trigger, I ended using other method of detection which work much more reliable.

When you leave the FEP default to "parallel", those files added in quick succession will trigger so many parallel flow, all executing in its own variable. It may cause chaos.

As the common practice, when there is flow dealing with external output, either file or remote network, better change the FEP to other, typically to "Wait". This way, all files will trigger, but the flow will be executing in queue until all the triggerer processed.

As for global wildcard, no it won't work as I tried. You need to catch all event, and use expression to check the file extension. So if there are 10 files copied to that folder, the flow will be triggered 10 times. But using expression, you can filter out that only the one with .pdf extension will pass and continue to your main flow.

You can use glovar in the path, but after setting it, you need to disable and reenable the flow so the glovar will populate the path properly. By execute flow on the flow with trigger file observer, do you mean to list the files? If you are trying to look for files in certain subfolder, better use action Init Variable File list.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

Post Reply