Results 1 to 3 of 3
Thread: Skipping links!!!
- 02-17-2010, 05:28 AM #1
Member
- Join Date
- Feb 2010
- Location
- Cuba
- Posts
- 2
- Rep Power
- 0
Skipping links!!!
Hi everyone!!!
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:
- 02-17-2010, 07:10 AM #2
Senior Member
- Join Date
- Aug 2009
- Posts
- 2,388
- Rep Power
- 6
You can use
where file is a java.nio.file.Path object.Java Code:Attributes.readBasicFileAttributes(file, LinkOption.NOFOLLOW_LINKS).isSymbolicLink();
Reading the API specs for those java.nio classes will make things clearer.
- 03-04-2010, 12:11 AM #3
Member
- Join Date
- Feb 2010
- Location
- Cuba
- Posts
- 2
- Rep Power
- 0
Nothing yet!!!
Hi
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.
Similar Threads
-
Finding web links
By ishdevil in forum New To JavaReplies: 2Last Post: 02-11-2010, 11:42 AM -
Skipping lines during debugging
By Taxi in forum New To JavaReplies: 2Last Post: 12-27-2008, 03:53 AM -
links between variables
By Keerti in forum New To JavaReplies: 2Last Post: 08-12-2008, 03:07 PM -
skipping input
By windie_86 in forum New To JavaReplies: 1Last Post: 02-12-2008, 07:09 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks