Search code examples
javascriptnode-red

node-red list content of a dynamic file name


I am trying to list all the content of a certain directory dynamically (the name of the folder is dynamic); and I'm facing some issues.

I found the node-red-contrib-fs node that list all the file in a directory and is pretty useful.

node

But I have not managed to pass the file name to it other than as a static field below.

node fields

Passing {{{global.path}}} or {{{global}}} in the Start Folder field does not work.

Neither do having the path in msg.filename or msg.foldername works.

Any suggestion would be much appreciated.


Solution

  • As documented in the info sidebar for the node, the Start Folder and Pattern can be overridden by passing in a msg object with the following fields msg.payload.start and msg.payload.pattern