Node-red watch for file modification executing 2 times

#1

From node-red watch node, it is executing two times for one file change. If file content not modified(saved) or tried to change also it is triggering. Is there any node which will execute once the file is modified(trigger per modification) or how to configure watch node as per requirement.

0 Likes

#2

The Watch node captures low-level file system events on the file. For example, writing content to a new file can generate two events - one for the initial creation and one for the content being written.

You could build some simple filtering into your flow to drop the duplicate events.

0 Likes

#3

I use a Trigger node to do this, output nothing on first event, wait for 10 seconds, extend delay if new message arrives, then send the latest message. The result is that it sends nothing until ten seconds after the last data being written to the file, then sends the last message it got, so I can take whatever action I need. Obviously you can adjust the ten second delay as appropriate.

0 Likes

#4

is there any other node for watching file modification

0 Likes