title: Getting just the lowest-level directory name for a file from split-path using PowerShell
body: <p>I need to get just the last part of the path name for a file.</p>
  
  <p>Example:</p>
  
  <pre><code>c:\dir1\dir2\dir3\file.txt
  </code></pre>
  
  <p>I need to get <code>dir3</code> into a variable.</p>
  
  <p>I have been trying with <code>Split-Path</code>, but it gives me the whole path.</p>