title: Get parent directory name in Node.js
body: <p>I am using Node.js, and I want to obtain the parent directory name for a 
  file. I have the file <code>"../test1/folder1/FolderIWant/test.txt"</code>.</p>
  
  <p>I want to get <code>"FolderIWant"</code>.</p>
  
  <p>I have tried:</p>
  
  <pre><code>var path = require('path');
  var parentDir = path.dirname(filename);
  </code></pre>
  
  <p>But it returns <code>../test1/folder1/FolderIWant</code>.</p>