by the file are you referring to the currently opened file in maya? since if you wanted that directory, wouldn't you just drop the -shn, and remove the file name from the string it gives you? string $name = `file -q -sn`;substitute("[^(\\/)]*$", $name, ""); or you could use the workspace command, if you use projects in…