Get directory of a file name in Javascript
If you use Node.js
, path
module is quite handy.
path.dirname("/home/workspace/filename.txt") // '/home/workspace/'
I don't know if there is any built in functionality for this, but it's pretty straight forward to get the path.
path = path.substring(0,path.lastIndexOf("\\")+1);