title: HTML5 File System - How to read directories using directory reader?
body: <p>I loaded a directory using file input and webkitdirectory as mentioned below.</p>
  
  <pre><code>&lt;input  id="file_input"  type="file" webkitdirectory directory  /&gt;
  </code></pre>
  
  <p>After directory selected I can read file size and other information. My question is how to read this directory using DirectoryReader interface. </p>
  
  <p>I tried with below code, but not success. results.length becomes zero. Am I missing anything?</p>
  
  <pre><code>window.requestFileSystem(TEMPORARY, 1024*1024 /*1MB*/, function(fs) {
          var dirReader = fs.root.createReader();
          var entries = [];
          // Call the reader.readEntries() until no more results are returned.
          var readEntries = function() {
              dirReader.readEntries(function(results) {
                  // If no more results are returned, we're done.
                  if (!results.length) {
                      // Sort list by name of entry.
                      entries.sort(function(a, b) {
                          return a.name &lt; b.name ? -1 :
                          b.name &lt; a.name ? 1 : 0;
                      });
                     // listResults(entries); // Render the list.
                  } else {
                      // Add in these results to the current list.
                      entries = entries.concat(toArray(results));
                      readEntries();
                  }
              }, errorHandler);
          };
          readEntries(); // Start reading the directory.
      }, errorHandler);
  </code></pre>
  
  <p>Any help is appreciated.</p>