Re: how to detect a hard link in Java?



Roedy Green writes:

> I have heard the Linux term "symbolic link".
>
> See http://mindprod.com/jgloss/linux.html
>
> Is a symbolic link soft or hard?

A man page for ln(1) says this of an option:

-s, --symbolic
make symbolic links instead of hard links

So a symbolic link is at least not hard. I think symbolic links may
also be called soft, sometimes.

As to the original question of somehow resolving a hard link, I don't
see how that can be done at all until some further criteria are
stated: the hard links to the same file are all equal, I think. We can
do things like the following.

touch orig (creates orig)
ln orig foo (aliases orig as foo)
ln orig bar (aliases orig as bar)
rm orig (removes the name orig; file remains as foo and bar)

Now there is a file that is known by the names "foo" and "bar", and
neither of them is its original name. Which should be the canonical
name? Maybe "bar" because it is alphabetically earlier. The aliases
might be in different directories, and then a shorter path might be
more canonical.
.



Relevant Pages