1

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.

Community
  • 1
  • 1
tomsv
  • 7,017
  • 5
  • 52
  • 87

1 Answers1

1

Take a look at java.nio.file.attribute.BasicFileAttributes.isSymbolicLink() available since Java 7

Evgeniy Dorofeev
  • 129,181
  • 28
  • 195
  • 266