Setting directory in "watcher" from context variable

I have been playing around with node red for a few days now. And there is something I cannot figure out. So I ask it here.

There exists a "watcher" node (as well as several variants, like "watcher directory" that you can use to watch a directory for changes, and then do something with the files. To configure it you need to set a "Files(s)" property which is just a string.

I do not like to statically code properties this way, as I plan on using this node a few times with the same value, and I like to keep things DRY.

So is there a way to refer to a context variable there in some way? I have been looking for information if I can interpolate variables there, but so far without success.

So is there a way?

You can use an externally set environment variable Using environment variables : Node-RED - or you can use one watcher node then link nodes to move the event to the other parts of your flow that need it.

Thanks. That worked, but it was not entirely the solution I wash hoping for.

Maybe I need to look for a better directory watchers. I have been playing around with node-red-contrib-watchdirectory-recursive but it has the disadvantage that I cannot tell it to watch for all events. So I need to instantiate three of them. And I was hoping that I cold configure them with a context variable that then would be initialized using a config node.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.