title: How can I iterate through all elements of local (server-side) folder?
body: <p>Basically, I have a very simple website where the root directory looks like:</p>
  
  <pre><code>/images/
  index.html
  stuff.js
  </code></pre>
  
  <p>I want some way to recursively iterate through every file in the /images/ directory and display them in order in a section of my website. So for example, if /images/ contained:</p>
  
  <pre><code>images/a/a.png
  images/b.png
  images/c.jpg
  ....
  </code></pre>
  
  <p>then somewhere in index.html would contain:</p>
  
  <pre><code>&lt;img src="images/a/a.png" /&gt;
  &lt;img src="images/b.png" /&gt;
  &lt;img src="images/c.jpg" /&gt;
  ....
  </code></pre>
  
  <p>My first idea was to do this using the document.write() function in stuff.js, but I couldn't find a good way to iterate through the local file directory in Javascript. I saw something about AJAX, but all of those examples involved editing an existing file, which I obviously don't want to do.</p>
  
  <p>My current solution is just to manual create an array of strings containing all of the files in /images/, but doing this makes me think "There's got to be a better way!"</p>
  
  <p>Let me know if I've been unclear.</p>
  
  <p>Thanks!</p>