DeanCording / node-red-contrib-fs-ops

A Node Red node for performing file system operations

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Wild cards - how to use them?

Just-another-pleb opened this issue · comments

I am wanting to move a bunch of files from "a" to "b".

I think I have that worked out, but not the file name part.

I want to move all files Reboot*

This is what the node does when I send it the message:

TypeError: Cannot read property 'length' of undefined    at MoveNode._inputCallback (/home/pi/.node-red/node_modules/node-red-contrib-fs-ops/fs-ops.js:62:25)    at MoveNode.Node._emitInput (/usr/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/nodes/Node.js:199:18)    at Immediate.<anonymous> (/usr/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/nodes/Node.js:179:33)    at runCallback (timers.js:810:20)    at tryOnImmediate (timers.js:768:5)    at processImmediate [as _immediateCallback] (timers.js:745:5)

This is what I have for the node but it doesn't work.
(I had * in the destination file name. The screen shot shows it as blank, as I was trying to get it working)

The paths are correct and set in the message.

Screenshot from 2020-03-21 16-59-05

Update:
This is the new flow but still doesn't work:

[{"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":"4041d2b2.18dad4","type":"function","z":"675e227d.d158b4","name":"Build stuff","func":"msg.destination = msg.payload + msg.directory;\nreturn msg;","outputs":1,"noerr":0,"x":810,"y":2030,"wires":[["f38ba075.85be2"]]},{"id":"f38ba075.85be2","type":"fan","z":"675e227d.d158b4","x":490,"y":2160,"wires":[["c60b20e3.1bfec8","d5e9569e.50cea","9b37182c.7af298"]]},{"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":640,"y":2200,"wires":[["823d9015.e08be","5beb0e3d.de20b"]]},{"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":790,"y":2200,"wires":[["ff10ceb0.1de5"]]}]

Old issue, but as far as I can understand from the code, wild cards are not supported in the Move node. Also, you have to specify explicitely a destination path.
@ maintainers: does it make sense to support an empty destFilename field (in which case, the _sourceFilename _ will be reused)?