Ah! split
!
(At time of posting it still isn't working, but I am looking at it because I probably have something set wrong)
Further reading shows me that I need to use msg.payload
to carry the names of the files.
Not msg.files
.
Reading the docs I saw that the file names were saved to something which is compatible with other fs-ops
nodes.
List of file names is stored in an array in the specified property. This array is suitable for passing to other fs-op nodes for further operations.
But I didn't think to put the split
node between them. (T'would be nice if that was explained better.)
Anyway.
Yes. The file/s are called Rebooted at YYYY-dd-mm HHmmss.txt
I've changed some of the names while learning/reading stuff and because I was shown how to use the template
node correctly.
Names:
directory /media/pi/06BB-C87D/logs/reboot/2020-12/
destination /media/pi/06BB-C87D/logs/reboot/2020-12/
path /media/pi/06BB-C87D/logs/
payload /media/pi/06BB-C87D/logs/reboot/
This is the flow as it stands now:
[{"id":"9b37182c.7af298","type":"delay","z":"675e227d.d158b4","name":"Delay","pauseType":"delay","timeout":"2","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":570,"y":2150,"wires":[["101f7e8a.bf1319"]]},{"id":"101f7e8a.bf1319","type":"split","z":"675e227d.d158b4","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":780,"y":2150,"wires":[["823d9015.e08be","5beb0e3d.de20b"]]},{"id":"4041d2b2.18dad4","type":"function","z":"675e227d.d158b4","name":"Build stuff","func":"msg.destination = msg.payload + msg.directory;\nreturn msg;","outputs":1,"noerr":0,"x":790,"y":2030,"wires":[["f38ba075.85be2","d5e9569e.50cea","c60b20e3.1bfec8","9b37182c.7af298"]]},{"id":"c60b20e3.1bfec8","type":"fs-ops-mkdir","z":"675e227d.d158b4","name":"","path":"payload","pathType":"msg","dirname":"directory","dirnameType":"msg","mode":"777","fullpath":"directory","fullpathType":"msg","x":600,"y":2110,"wires":[["dccc27aa.d4186"]]},{"id":"d5e9569e.50cea","type":"debug","z":"675e227d.d158b4","name":"IN","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":570,"y":2070,"wires":[]},{"id":"823d9015.e08be","type":"fs-ops-move","z":"675e227d.d158b4","name":"","sourcePath":"payload","sourcePathType":"msg","sourceFilename":"files","sourceFilenameType":"msg","destPath":"destination","destPathType":"msg","destFilename":"files","destFilenameType":"msg","link":false,"x":940,"y":2150,"wires":[["ff10ceb0.1de5"]]},{"id":"5beb0e3d.de20b","type":"debug","z":"675e227d.d158b4","name":"1d","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":930,"y":2190,"wires":[]},{"id":"570a0b23.860d0c","type":"fs-ops-dir","z":"675e227d.d158b4","name":"","path":"payload","pathType":"msg","filter":"Rebooted at*","filterType":"str","dir":"files","dirType":"msg","x":580,"y":2030,"wires":[["3c25455c.e66b0a","4041d2b2.18dad4"]]},{"id":"dccc27aa.d4186","type":"debug","z":"675e227d.d158b4","name":"1","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":780,"y":2110,"wires":[]},{"id":"ff10ceb0.1de5","type":"debug","z":"675e227d.d158b4","name":"2","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":1090,"y":2150,"wires":[]},{"id":"791399b9.493ee","type":"template","z":"675e227d.d158b4","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{{{path}}}reboot/","output":"str","x":350,"y":2030,"wires":[["74e6ce8a.becc68","570a0b23.860d0c"]]},{"id":"3c25455c.e66b0a","type":"debug","z":"675e227d.d158b4","name":"OUT","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":780,"y":1990,"wires":[]},{"id":"8ed6e064.5d98e","type":"change","z":"675e227d.d158b4","name":"","rules":[{"t":"move","p":"payload","pt":"msg","to":"directory","tot":"msg"},{"t":"set","p":"path","pt":"msg","to":"log_paths","tot":"global"}],"action":"","property":"","from":"","to":"","reg":false,"x":600,"y":1990,"wires":[["791399b9.493ee","8921a9ee.bfb6d8"]]},{"id":"74e6ce8a.becc68","type":"debug","z":"675e227d.d158b4","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":570,"y":1950,"wires":[]},{"id":"c99fea29.aeaf1","type":"moment","z":"675e227d.d158b4","name":"","topic":"","input":"","inputType":"msg","inTz":"Australia/Sydney","adjAmount":0,"adjType":"days","adjDir":"add","format":"YYYY-ww/","locale":"en_AU","output":"","outputType":"msg","outTz":"Australia/Sydney","x":390,"y":1990,"wires":[["8ed6e064.5d98e"]]},{"id":"8921a9ee.bfb6d8","type":"debug","z":"675e227d.d158b4","name":"RAW","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":780,"y":1950,"wires":[]},{"id":"efce41db.b9d1c","type":"inject","z":"675e227d.d158b4","name":"Test","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":380,"y":2260,"wires":[["c99fea29.aeaf1"]]}]