title: How to read a random folder structure with Javascript living at the same level as index.html
body: <p>I am working on a testing reporting tool that generates a list of images grouped by folders, so you could end up with a structure like this:</p>
  
  <p><code>
  root/
    /counter/
      img1.png
      img2.png
    /alarm/
      img3.png
  </code></p>
  
  <p>where <code>counter</code> and <code>alarm</code> are not fixed names: these are given by the user in a previous step, so they might change all the time. </p>
  
  <p>What I want to do is to add a <code>index.html</code> inside <code>root</code> that can list all the folders and images inside those folders with javascript, but I can't seem to find the right JS API to do this. I have no problems generating the <code>index.html</code> report, but I don't know what should be the exact JS script to read that folder structure that is not fixed. Any ideas?</p>