Is there any way to check msg.payload is a file or folder?

I would like to check if msg.payload is a file or a directory without using the function node,
is there a node that can check this?
Please tell me!
Thanks.

You really haven’t given enough information for anyone to help you.
Where is msg.payload coming from?
What else is in the msg object?

1 Like

I can only assume (due to lack of information / screen shots) that you mean "I would like to check if the string value contained in msg.payload is a file or a directory" - is that what you mean?

If so, you can use fs-ops

image

[{"id":"2d2407c0.e47ad8","type":"inject","z":"d1c281e9.1a622","name":"myfolder","topic":"myfolder","payload":"myfolder","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":1520,"y":80,"wires":[["7a0a4cf0.988b14"]]},{"id":"3e55bccd.fbf104","type":"inject","z":"d1c281e9.1a622","name":"img.png","topic":"img.png","payload":"img.png","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":1510,"y":120,"wires":[["7a0a4cf0.988b14"]]},{"id":"7a7799a0.09e508","type":"debug","z":"d1c281e9.1a622","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":1690,"y":120,"wires":[]},{"id":"7a0a4cf0.988b14","type":"fs-ops-type","z":"d1c281e9.1a622","name":"","path":"c:\\temp","pathType":"str","filename":"payload","filenameType":"msg","filetype":"type","filetypeType":"msg","x":1680,"y":80,"wires":[["7a7799a0.09e508"]]}]
1 Like

@Steve-Mcl Amazing, exactly what I wanted to do, 1000 likes :blush:
Thank everyone for the support!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.