Hello
I suspect I have found a working solution in the meantime (@zenofmud his method). The "fs-delete-nodes" are not yet connected in the flow. The debug msg does give me what I suspect to be correct. (Edit: flow does the job)
I know it is not the most optimal solution, but for me (as a non-ITprogrammer) it made sense.
Thanks again for your quick help!
Flow:
[{"id":"6808f52.910390c","type":"fs-ops-dir","z":"cf09de64.c4fd8","name":"Alarm-log","path":"*/Logging/Alarmen/","pathType":"str","filter":"*","filterType":"str","dir":"files","dirType":"msg","x":700,"y":500,"wires":[["a8d06a8b.5ac288"]]},{"id":"139ad9b5.143da6","type":"inject","z":"cf09de64.c4fd8","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"00 00 * * *","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":410,"y":500,"wires":[["7477f49f.df8d0c"]]},{"id":"1eacf218.4eaffe","type":"fs-ops-dir","z":"cf09de64.c4fd8","name":"PLC-log","path":"*/Logging/PLC-log/","pathType":"str","filter":"*","filterType":"str","dir":"files","dirType":"msg","x":700,"y":540,"wires":[["c0af9e83.9b12b"]]},{"id":"52da3ec0.854cc","type":"comment","z":"cf09de64.c4fd8","name":"Verwijderen oude log-files.","info":"Delete old files. \nBewaren = Save\nVerwijderen = Delete\n\nControle = control \n","x":430,"y":460,"wires":[]},{"id":"f77bb176.233c3","type":"split","z":"cf09de64.c4fd8","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":1170,"y":500,"wires":[["acfc74ca.79cdc8"]]},{"id":"86456a48.432958","type":"change","z":"cf09de64.c4fd8","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"files","tot":"msg"},{"t":"set","p":"controle","pt":"msg","to":"Klaar om te testen.","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1020,"y":500,"wires":[["f77bb176.233c3"]]},{"id":"bd988199.8f2ba","type":"function","z":"cf09de64.c4fd8","name":"Controle","func":"var bestand = msg.payload; \nvar datum = bestand.substring(0, 10);\ndatum = new Date(datum);\nmsg.controle = \"Bewaren\";\nvar filename;\nvar grensdatum = new Date(msg.grensdatum);\n\nif (grensdatum > datum){ \n msg.controle = \"Verwijderen\";\n filename = msg.payload; \n \n}\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1480,"y":500,"wires":[["2dfe4beb.bd5154"]]},{"id":"7477f49f.df8d0c","type":"function","z":"cf09de64.c4fd8","name":"","func":"var dagen = 7; // Days you want to subtract+1\nvar datum = new Date();\nvar grens_datum = new Date(datum.getTime() - (dagen * 24 * 60 * 60 * 1000));\nvar dag = grens_datum.getDate();\nvar maand =grens_datum.getMonth()+1;\nvar jaar =grens_datum.getFullYear();\n\n\nmsg.grensdatum = grens_datum;\nreturn msg; ","outputs":1,"noerr":0,"initialize":"","finalize":"","x":560,"y":500,"wires":[["6808f52.910390c","1eacf218.4eaffe"]]},{"id":"acfc74ca.79cdc8","type":"change","z":"cf09de64.c4fd8","name":"","rules":[{"t":"delete","p":"files","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1320,"y":500,"wires":[["bd988199.8f2ba"]]},{"id":"2dfe4beb.bd5154","type":"switch","z":"cf09de64.c4fd8","name":"","property":"controle","propertyType":"msg","rules":[{"t":"eq","v":"Verwijderen","vt":"str"},{"t":"eq","v":"Bewaren","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":1610,"y":500,"wires":[["3378ab9c.993fb4"],["564ee27d.0bf5dc"]]},{"id":"c0af9e83.9b12b","type":"change","z":"cf09de64.c4fd8","name":"Type: PLC","rules":[{"t":"set","p":"type","pt":"msg","to":"PLC","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":850,"y":540,"wires":[["86456a48.432958"]]},{"id":"a8d06a8b.5ac288","type":"change","z":"cf09de64.c4fd8","name":"Type: Alarm ","rules":[{"t":"set","p":"type","pt":"msg","to":"ALARM","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":850,"y":500,"wires":[["86456a48.432958"]]},{"id":"564ee27d.0bf5dc","type":"debug","z":"cf09de64.c4fd8","name":"Save","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1730,"y":540,"wires":[]},{"id":"3378ab9c.993fb4","type":"switch","z":"cf09de64.c4fd8","name":"","property":"type","propertyType":"msg","rules":[{"t":"eq","v":"ALARM","vt":"str"},{"t":"eq","v":"PLC","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":1730,"y":500,"wires":[["46d44c48.7d9a14"],["c6b63966.6f12b8"]]},{"id":"46d44c48.7d9a14","type":"debug","z":"cf09de64.c4fd8","name":"Delete Alarm","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1890,"y":500,"wires":[]},{"id":"c6b63966.6f12b8","type":"debug","z":"cf09de64.c4fd8","name":"Delete PLC","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1890,"y":540,"wires":[]},{"id":"b42e917.367577","type":"fs-ops-delete","z":"cf09de64.c4fd8","name":"Delete PLC-log","path":"*/Logging/PLC-log/","pathType":"str","filename":"payload","filenameType":"msg","x":2120,"y":540,"wires":[[]]},{"id":"226e71e0.13202e","type":"fs-ops-delete","z":"cf09de64.c4fd8","name":"Delete Alarm-log","path":"*/Logging/Alarmen/","pathType":"str","filename":"payload","filenameType":"msg","x":2130,"y":500,"wires":[[]]}]
Arne