I want to populate the dashboard dropdown node with a list of whatever .jpg files are present in a folder which is located on a usb stick pugged into my pi, when I open the dropdown in the dashboard I want to be able to choose one of the file names in the drop down list and have it sent to the output of the dropdown node.
I can get a list of files using the exec node with cmd ls /media/usbPEN/nas/snap/
result is a string as see picture below...
The problem I have is how do I populate the Value / Label field for each file name into the dropdown node.
There is readdir node, node-red-contrib-readdir (node) - Node-RED which does the job all in one action . Reads the directory, puts result in array, and sets it to the msg.options so can be feed directly to the dropdown node.
hotNipi
That readdir node is awesome, I've been scratching my head all afternoon trying things before I asked for help, thanks again for this info its brilliant, I am so happy..
Steve-Mci
ill take a look at the fs-ops node tomorrow, the readdir node is going to take some beating though, thanks for your input.
Me again .. I have one further question .. I want to send the directory path into the readdir node however I'm struggling to find a solution, unlike say the file nodes were you send msg.filename the Directory field cannot be left blank, I tried msg.payload {{msg.payload}} path, directory, dir in there but nothing appears to work , HOW ?