# How to read from a connected external drive and display the files in it as options of a dropdown box?

**URL:** <https://discourse.nodered.org/t/how-to-read-from-a-connected-external-drive-and-display-the-files-in-it-as-options-of-a-dropdown-box/36273>\
**Category:** General\
**Created:** [21 November 2020 04:44 UTC](https://discourse.nodered.org/t/how-to-read-from-a-connected-external-drive-and-display-the-files-in-it-as-options-of-a-dropdown-box/36273 "2020-11-21T04:44:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![madironman](https://avatars.discourse-cdn.com/v4/letter/m/ba8739/32.png) [@madironman](https://discourse.nodered.org/u/madironman)\
**Post date:** [21 November 2020 04:44 UTC](https://discourse.nodered.org/t/how-to-read-from-a-connected-external-drive-and-display-the-files-in-it-as-options-of-a-dropdown-box/36273/1 "2020-11-21T04:44:41Z")

</div>

Hi guys, I am trying to make a project which involves an alarm as part of the system, I am implementing this on raspberry-pi using node-red. I want to have an drop down box with list of files from a drive that the user had connected (Eg pen-drive) so that the user can select among those files to be used as ringtone for the Alarm. Is there any simple way to do it? I have already figured out the music playing part.

```auto
[{"id":"9657ba13.df9f98","type":"switch","z":"e10131f9.ffd3c","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"Action running","vt":"str"},{"t":"eq","v":"Not running","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":860,"y":2940,"wires":[["55d1ee4b.32d1d"],["345e41f0.7c8a7e"]]},{"id":"55d1ee4b.32d1d","type":"change","z":"e10131f9.ffd3c","name":"start","rules":[{"t":"set","p":"payload","pt":"msg","to":"start","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1000,"y":2940,"wires":[["a86e36d4.030fa8","782072d1.8f875c"]]},{"id":"345e41f0.7c8a7e","type":"change","z":"e10131f9.ffd3c","name":"stop","rules":[{"t":"set","p":"payload","pt":"msg","to":"stop","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1000,"y":2980,"wires":[["74ceba53.1547c4","e513a5b6.8053e8"]]},{"id":"f5e5a928.de86d8","type":"debug","z":"e10131f9.ffd3c","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1380,"y":2960,"wires":[]},{"id":"a86e36d4.030fa8","type":"debug","z":"e10131f9.ffd3c","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1060,"y":2860,"wires":[]},{"id":"74ceba53.1547c4","type":"debug","z":"e10131f9.ffd3c","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1110,"y":3080,"wires":[]},{"id":"e513a5b6.8053e8","type":"PlaySound","z":"e10131f9.ffd3c","name":"","playerOptions":"{}","audioURI":"","options":"{}","x":1200,"y":2960,"wires":[["782072d1.8f875c","f5e5a928.de86d8"]]},{"id":"892d2381.c7ca8","type":"rbe","z":"e10131f9.ffd3c","name":"","func":"rbe","gap":"","start":"","inout":"out","property":"payload","x":710,"y":2940,"wires":[["9657ba13.df9f98"]]},{"id":"782072d1.8f875c","type":"function","z":"e10131f9.ffd3c","name":"","func":"if((msg.payload == \"start\") || (msg.payload == \"end\")){\n msg.payload = \"start\";\n msg.audioURI = global.get(\"audioURI\");\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1190,"y":2920,"wires":[["e513a5b6.8053e8","2b6a1a88.6915a6"]]},{"id":"3c4fbd9b.48d8e2","type":"ui_dropdown","z":"e10131f9.ffd3c","name":"","label":"","tooltip":"","place":"","group":"ab503ff3.dd426","order":0,"width":0,"height":0,"passthru":true,"multiple":false,"options":[{"label":"beautiful_spring_melody.mp3","value":"/home/pi/.node-red/music/beautiful_spring_melody.mp3","type":"str"},{"label":"blue_monday-freemobi.mp3","value":"/home/pi/.node-red/music/blue_monday-freemobi.mp3","type":"str"},{"label":"carol_of_the_bells-alarm.mp3","value":"/home/pi/.node-red/music/carol_of_the_bells-alarm.mp3","type":"str"},{"label":"fantasy_alarm_clock.mp3","value":"/home/pi/.node-red/music/fantasy_alarm_clock.mp3","type":"str"},{"label":"witch_waltz-halloween_alarm.mp3","value":"/home/pi/.node-red/music/witch_waltz-halloween_alarm.mp3","type":"str"}],"payload":"","topic":"","x":880,"y":3120,"wires":[["97f181a7.a4e82","ff5190a9.e0a14"]]},{"id":"97f181a7.a4e82","type":"change","z":"e10131f9.ffd3c","name":"","rules":[{"t":"set","p":"audioURI","pt":"global","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1130,"y":3120,"wires":[[]]},{"id":"ff5190a9.e0a14","type":"debug","z":"e10131f9.ffd3c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1370,"y":3140,"wires":[]},{"id":"2b6a1a88.6915a6","type":"debug","z":"e10131f9.ffd3c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1280,"y":2860,"wires":[]},{"id":"ab503ff3.dd426","type":"ui_group","name":"Set the Alarm Tone","tab":"80684db2.ebe2","order":6,"disp":true,"width":"6","collapse":false},{"id":"80684db2.ebe2","type":"ui_tab","name":"Interval Timer","icon":"dashboard","order":12,"disabled":false,"hidden":false}]

```

The above is the flow for the existing implementation, Is there a way to make the dropdown box dynamic to list all the contents of a connected drive and also point audio URL to the connected drive?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [20 January 2021 04:44 UTC](https://discourse.nodered.org/t/how-to-read-from-a-connected-external-drive-and-display-the-files-in-it-as-options-of-a-dropdown-box/36273/2 "2021-01-20T04:44:58Z")

</div>

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