title: Find all files in a site with Alfresco 4.1 webscripts
body: <p>Alfresco Share doesn't keep track of content modified outside it's interface which makes the recently modified RSS/Dashlet useless. I'm working on creating an RSS that I can use within sites to pull a list of recently modified items.</p>
  
  <p>Right now I'm just working on getting the list of files and I'm stumbling a little bit as I'm not very familiar with Webscripts. I've got this piece of code that will retrieve the contents of a site then build an array of the files, the problem I'm running into is I could have many subfolders and I'm not sure how to properly traverse them.</p>
  
  <pre class="lang-js prettyprint-override"><code>var folder = companyhome.childByNamePath("/Sites/foo/documentLibrary");
  
  var docs = new Array();
  
  print(folder);
  print("iterating...");
  var children = folder.children;
  for (i=0; i&lt;children.length; i++)
  {
    var c = children[i];
    if (c.isContainer)
    {
      print(c.name + " is a folder, traversing...");
      var subfolder = companyhome.childByNamePath("/Sites/foo/documentLibrary/" + c.name.toString());
      var subchildren = subfolder.children;
      for (j=0; j&lt;subchildren.length; j++)
      {
        var d = subchildren[j];
        if (d.isDocument) docs.push(d);
      }
    }
    if (c.isDocument) docs.push(c);
  }
  
  print(docs);
  </code></pre>
  
  <p>In the end I'll sort by modified time then chop it for presentation, I'm operating under the assumption that getting the content is the hard part :)</p>