Get Directory of a File Name in Javascript
<p>How to get the directory of a file?</p>

<p>For example, I pass in a string</p>

<pre><code>C:\Program Files\nant\bin\nant.exe
</code></pre>

<p>I want a function that returns me </p>

<pre><code>C:\Program Files\nant\bin
</code></pre>

<p><em>I would prefer a built in function that does the job, instead of having manually split the string and exclude the last one.</em> </p>

<p><strong>Edit: I am running on Windows</strong></p>
