I'm developing an recursive algorithm to search for files. Everything works fine until my program gets into a link(I mean to Linux symbolic links) which is pointing toward a folder. This link is located in a sub-folder of the folder to which has been linked, so it's generating an endless loop. Well, how to solve this?
I have made this other times, but using c/c++. In those case I just simply tell to my algorithm:
"Skip the links and goes ahead."
...but how can I get the same using Java?
I was looking for something with the same behavior of isDirectory(), maybe something like isLink()... but I get my hands empty.
I hope somebody help me with a link, an example, a clue or whatever.
Thanks in advance... :rolleyes:
You can use
where file is a java.nio.file.Path object.
Reading the API specs for those java.nio classes will make things clearer.
I've been all this time trying to get working the recursion of my algorithm using the help of "r035198x" but I receive several errors when I compile.
Well, the source of those errors was simply that "java.nio.file" is implemented in the JDK7(the next major release of the Java™ SE Platform) and the version that I've installed is the JDK6.
...so how can I get the same using the JDK6?
I believe there have to be some way to get it work. I can't imagine that all developers have to wait until the next version of JDK to do something like what I'm doing.
Thanks in advance.