title: Need help replicating directory structure with ColdFusion and jsTree
body: <p>I am using this new jQuery plugin called jsTree www.jstree.com and using the HTML datasource.<br>
  I am also using ColdFusion 7 with cfdirectory and filtering out files, so just dirs.
  I need to recreate the directory structure in the image, well any dir structure I give it actually. I am having a heck of a time with the logic.
  variables.imageDirectoriesLen = 8 in this scenario cause I am outputting from the middle of the actual file path, not from begining.</p>
  
  <p>Thanks for the help.<br>
  Derek  </p>
  
  <p><a href="https://i.stack.imgur.com/inktF.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/inktF.png" alt="alt text"></a>
  </p>
  
  <p>this is what I have so far</p>
  
  <pre><code>&lt;cfoutput query="clientImageDirsFilter"&gt;
  &lt;cfset nextLen = 0 /&gt;
  &lt;cfset nextDir = "" /&gt;
  &lt;cfset nextRowCnt = currentRow+1 /&gt;
  
  &lt;cfset nextDir = clientImageDirsFilter.directory[nextRowCnt] &amp; "\" &amp; clientImageDirsFilter.name[nextRowCnt] /&gt;
  &lt;cfset nextLen = listLen(nextDir, "\") /&gt;
  &lt;cfset currLen = listLen(clientImageDirsFilter.directory &amp; "\" &amp; clientImageDirsFilter.name,"\") /&gt;
  
  &lt;cfif currLen eq nextLen&gt;
  &lt;li rel="folder" id="node_#randRange(1,99999)#"&gt;&lt;a href="##"&gt;&lt;ins&gt;&amp;nbsp;&lt;/ins&gt;#clientImageDirsFilter.name#&lt;/a&gt;&lt;/li&gt;
  &lt;cfelseif nextLen lt currLen&gt;
  
      &lt;cfif nextLen eq 0&gt;
          #repeatString("&lt;/li&gt;&lt;/ul&gt;",(currLen-nextLen-variables.imageDirectoriesLen))#
      &lt;/cfif&gt;
  
  &lt;cfelse&gt;                                        
  &lt;ul&gt;
      &lt;li rel="folder" id="node_#randRange(1,99999)#"&gt;&lt;a href="##"&gt;&lt;ins&gt;&amp;nbsp;&lt;/ins&gt;#clientImageDirsFilter.name#&lt;/a&gt;
          &lt;ul&gt;
  &lt;/cfif&gt;
  </code></pre>
  
  <p></p>