atm. im using the watch node on a folder, it shows what is happening in the folder, both when I correct, create and delete files.
What I want is to just look at which files are being created and they should only be .jpg files.
So my first question is:
- How can I get a hit, about which files are created, I have no interest in what is deleted or changed.
- To get only one hit on .jpg files, is it so best to use a switch node where I find out to look at my payload around * .jpg and so that way get my hits sent on .jpg files?
Or is it a better / second option?
Why not use a
switch node after the
watch Node using the ‘contains’ option and jpeg as the value. So in English it would be “if msg.payload contains ‘jpeg’’
okay as I wrote, but using the "contains" Thx.
What about the question about created files, atm. it will "hit me" if I delete, modify or create a new JPG file, and I need it only to work if created.
The node can't possibly tell what has changed. What you could try is use node-red-contrib-fs to read the directory and store that information. Then when the
watch node triggers you could use the
fs-file-lister to get the info for that file and compare if against the saved information and determine what has happened to the file.
I used the "Watch-directory" from node-red-contrib-watchdirectory.
And it works well, as wanted.
Nice, I hadn’t seen that node before. Nice find!
Indeed - would make a good update to the core node.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.