How to get current clicked folder from an array and read it with readdirSync?

Hi,

I can’t find anywhere how I could get the current folder from an array and show what is inside it in another array, I’ve also tried using __dirname but I can’t get it to work :frowning:
I have only managed to get the index number on click but that doesn’t help :frowning:

Thanks!