Build array of parent paths back
<p>I need to build an array of paths based on the current directory back to a predefined top level directory.</p>

<p>In Javascript have two variables 'topLevelDirectory' and 'currentDirectory'</p>

<p>I need an array of all paths in between. </p>

<p>example :</p>

<pre><code> topLevelDirectory = "/sectionA/sectionB"
    currentDirectory = "/sectionA/sectionB/sectionC/sectionD/sectionE
</code></pre>

<p>"</p>

<p>I need an array 'allPaths' that would have the values:</p>

<pre><code>allPaths[0] = '/sectionA/sectionB/'
   allPaths[1] = '/sectionA/sectionB/sectionC/'
   allPaths[2] = '/sectionA/sectionB/sectionC/sectionD/'
   allPaths[3] = '/sectionA/sectionB/sectionC/sectionD/sectionE/'
</code></pre>

<p>I am using Jquery.</p>

<p>I know I can split currentDirectory but then I am not getting the value I need,
  'sectionC' instead of '/sectionA/sectionB/sectionC/'</p>

<p>I am not expecting the full code to the answer, just some help in what functions or procedures I should be trying to tie together.</p>

<p>Any help is appreciated.</p>
