Once you get the directory you can pull it apart and look at level above, I think the lisp I am looking for is splitstr it is a lisp function odd name, I have used it.
"C:\\dir1\\dir2\\dir3\\dir4"
so = ("dir1" "dir2" dir3" dir4") so answer required is c:\\dir1\\dir2\\dir3 ie strcat (up to length-1)