This is funny, because we're both wrong.
My expression did have a typo. I've corrected it.
The correct version is here:=ListItem([Filename (path)],Math(Listcount([Filename (path)],\) - 1),\)
Your expression is wrong, but accidentally evaluates to give the desired answer, but only in the beta version of MC27. In any released version, your expression returns nothing.
It's actually
=ListItem([Filename (path)],Math(ListCount([Filename (path)]) - 2),\)
The problem with what you posted is that ListCount([Filename (path)]) - 2) returns -1 not because it's correct, but because you didn't specify the delimiter of the list in ListCount. Your ListCount() will always return 1 (at least if there are no ; in the path) no matter how long the [Filename (path)] is because you're not separating elements by \. So it always returns 1, from which you subtract -2, which leaves you with -1.
Your expression still evaluates ok
for you, because you are running the latest beta, and you are passing ListItem -1 as the index. If you'd tested on a release version, you'd have seen the expression doesn't work, because -1 is an invalid index. But you're supposed to be passing the actual positive index number of the last item in the list, which is all the OP can use, since he doesn't have that feature in his release.
So like I said before, to use ListItem to retrieve the last item in the list, the correct answer is always ListCount-1, and never ListCount-2.
So e-head, use this:ListItem([Filename (path)],Math(Listcount([Filename (path)],\) - 1),\)
It works in all versions of MC, including yours.