<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Loop through sub-folders in Alfresco Forum</title>
    <link>https://connect.hyland.com/t5/alfresco-forum/loop-through-sub-folders/m-p/82527#M25348</link>
    <description>&lt;P&gt;Hi &lt;A href="https://migration33.stage.lithium.com/t5/user/viewprofilepage/user-id/55494"&gt;@patrickvanhoof&lt;/A&gt; ,&lt;/P&gt;
&lt;P&gt;Have you thought of using a query instead =&amp;gt; &lt;A href="https://hub.alfresco.com/t5/alfresco-content-services-forum/list-all-folder-subfolders-files-via-webscript/td-p/160033" target="_self" rel="nofollow noopener noreferrer"&gt;https://hub.alfresco.com/t5/alfresco-content-services-forum/list-all-folder-subfolders-files-via-webscript/td-p/160033&amp;nbsp;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;This might be more efficient than walking a heavily populated tree?&lt;/P&gt;
&lt;P&gt;HTH&lt;/P&gt;</description>
    <pubDate>Wed, 12 Feb 2020 14:37:10 GMT</pubDate>
    <dc:creator>EddieMay</dc:creator>
    <dc:date>2020-02-12T14:37:10Z</dc:date>
    <item>
      <title>Loop through sub-folders</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/loop-through-sub-folders/m-p/82526#M25347</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I want to loop through sub-folders of a certain folder via javascript. My code looks like this:&lt;/P&gt;&lt;PRE&gt;function processNodes(myNodes) {
	for (i = 0; i &amp;lt; myNodes.length; i++) {
		doSomething(myNodes[i]);
		if (recursive) 
		{
			childNodes = myNodes[i].childFileFolders(false, true);				
			if (childNodes.length) {
				processNodes(childNodes);
			}
		}
	}
}

var referenceType = "node"; 
var reference = ["workspace", "SpacesStore", "e2686b75-7ebf-45a3-8364-7613001c6e14"];
foundNode = search.findNode(referenceType, reference);
nodes = foundNode.childFileFolders(false, true);
processNodes(nodes);&lt;/PRE&gt;&lt;P&gt;The&amp;nbsp;nodes = foundNode.childFileFolders(false, true); returns two folders. But the function processNodes only handles the first one. I would expect that it also handles the second one because recursive = true. But it does not. What am I doding wrong?&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Patrick&lt;/P&gt;</description>
      <pubDate>Wed, 12 Feb 2020 13:33:45 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/loop-through-sub-folders/m-p/82526#M25347</guid>
      <dc:creator>patrickvanhoof</dc:creator>
      <dc:date>2020-02-12T13:33:45Z</dc:date>
    </item>
    <item>
      <title>Re: Loop through sub-folders</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/loop-through-sub-folders/m-p/82527#M25348</link>
      <description>&lt;P&gt;Hi &lt;A href="https://migration33.stage.lithium.com/t5/user/viewprofilepage/user-id/55494"&gt;@patrickvanhoof&lt;/A&gt; ,&lt;/P&gt;
&lt;P&gt;Have you thought of using a query instead =&amp;gt; &lt;A href="https://hub.alfresco.com/t5/alfresco-content-services-forum/list-all-folder-subfolders-files-via-webscript/td-p/160033" target="_self" rel="nofollow noopener noreferrer"&gt;https://hub.alfresco.com/t5/alfresco-content-services-forum/list-all-folder-subfolders-files-via-webscript/td-p/160033&amp;nbsp;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;This might be more efficient than walking a heavily populated tree?&lt;/P&gt;
&lt;P&gt;HTH&lt;/P&gt;</description>
      <pubDate>Wed, 12 Feb 2020 14:37:10 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/loop-through-sub-folders/m-p/82527#M25348</guid>
      <dc:creator>EddieMay</dc:creator>
      <dc:date>2020-02-12T14:37:10Z</dc:date>
    </item>
    <item>
      <title>Re: Loop through sub-folders</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/loop-through-sub-folders/m-p/82528#M25349</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;PRE&gt;nodes = search.query({
	language: 'fts-alfresco',
	query: 'ANCESTOR:"workspace://SpacesStore/e2686b75-7ebf-45a3-8364-7613001c6e14"',
	maxItems: 2000
});&lt;/PRE&gt;&lt;P&gt;This indeed works much better/faster.&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;Patrick&lt;/P&gt;</description>
      <pubDate>Thu, 13 Feb 2020 07:43:26 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/loop-through-sub-folders/m-p/82528#M25349</guid>
      <dc:creator>patrickvanhoof</dc:creator>
      <dc:date>2020-02-13T07:43:26Z</dc:date>
    </item>
    <item>
      <title>Re: Loop through sub-folders</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/loop-through-sub-folders/m-p/82529#M25350</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;A href="https://migration33.stage.lithium.com/t5/user/viewprofilepage/user-id/55494"&gt;@patrickvanhoof&lt;/A&gt;,&lt;/P&gt;
&lt;P&gt;Thanks for reporting back - and for the code snippet. Will help other people in the same situation.&lt;/P&gt;
&lt;P&gt;Are you thinking about attending &lt;A href="https://devcon.alfresco.com" target="_self" rel="nofollow noopener noreferrer"&gt;DevCon 2020&lt;/A&gt;?&amp;nbsp; &lt;A href="https://www.papercall.io/alfrescodevcon2020" target="_self" rel="nofollow noopener noreferrer"&gt;Full session speakers&lt;/A&gt; get a free ticket!&lt;/P&gt;</description>
      <pubDate>Thu, 13 Feb 2020 10:19:14 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/loop-through-sub-folders/m-p/82529#M25350</guid>
      <dc:creator>EddieMay</dc:creator>
      <dc:date>2020-02-13T10:19:14Z</dc:date>
    </item>
  </channel>
</rss>

