title: Relative filename from absolute and given base path
body: <p>How to get relative filename from absolute one and some given path?  </p>
  
  <p>For example:  </p>
  
  <pre><code>foo('/a/b/c/1.txt', '/a/d/e');    // '../../b/c/1.txt'
  foo('/a/b/../d/1.txt', '/a/d/e'); // '../c/1.txt'
  </code></pre>
  
  <p>Is there some native function for this?  </p>
  
  <p>My thoughts, if there is not:   </p>
  
  <ul>
  <li>Normalize both params: need to use some <code>realpath</code> replacement, because files can to not exist. <a href="https://stackoverflow.com/q/20522605/2110496">example</a></li>
  <li>Cut common parts from both</li>
  <li>add rest parts from $basepath as '..'</li>
  </ul>
  
  <p>Manual way looks too heavy for that common task..</p>