A good idea.
However with this method you can not tell whether there was a directory name in the path, which itself was a symbolic link.
$ file bubu huhu
bubu: directory
huhu: symbolic link to bubu
$ ls -l bubu/birka huhu/birka
-rw-r--r--1 ijbalazs users4169 2004-03-26 14:25 bubu/birka
-rw-r--r--1 ijbalazs users4169 2004-03-26 14:25 huhu/birka
$ java ms huhu/birka
/home/ijbalazs/source/eBank/eBank8/bubu/birka
/home/ijbalazs/source/eBank/eBank8/huhu/birka
If you want to know if the parent directory is a symbolic link then repeat the code from Reply 1, applied to the parent directory. Do this recursively until you arrive at a directory that is not a link (according to Reply 1 criteria). Then the directory or file in the previous step must have been a link.
My untested stab at an improved algorithm. BIJ001, go ahead and demolish that.
> BIJ001, go ahead and demolish that.
I won't. On the given level of our knowledge, this imporeved version should obviously work. But the improvement seemed necessary and therefore I had taken the liberty to make my modest remark.
On the other hand, it would not be very difficult to write a native wrapper for "stat" in order to cope besides symlinks with other "monsters" dwelling in the file system as sockets, named pipes, devices...