Obtenga DIR de FilePath JavaScript
path = path.substring(0,path.lastIndexOf("\\")+1);
Samiksha Singla
path = path.substring(0,path.lastIndexOf("\\")+1);
path.dirname("/home/workspace/filename.txt") // '/home/workspace/'