Reputation: 7277
How can I detect whether a File
f
is a symbolic link (in the unix sense, as created by ln -s source target
) or a normal file/directory?
I am using Java 8
and OS X
, CentOS
and Ubuntu
.
In this question they kind of solve it for Java 6
. Is there something better in Java 8
?
I would like to later use this in order to handle files and directories on a different file system in a different way.
Upvotes: 1
Views: 228
Reputation: 135992
Take a look at java.nio.file.attribute.BasicFileAttributes.isSymbolicLink()
available since Java 7
Upvotes: 1