title: How can I join an array from an intermediate point to the end or the end - 1?
body: <p>I need to compare files throughout two directory structures. The base of the directories starts at the second element in the <code>DirectoryName</code> property. However, I do not know how many additional elements there will be in the path. Using <code>999</code> as the end of the range works, but surely there is a better way to do this.</p>
  
  <pre><code>PS&gt;Get-ChildItem -File -Recurse -Path "$Env:USERPROFILE\Documents" |
      ForEach-Object {
          $_.DirectoryName.Split('\')[2..999] -join '\'
      }
  </code></pre>
  
  <p>Using a range of <code>[2..-1]</code> does not work.</p>