Results 1 to 2 of 2
- 07-28-2009, 05:07 PM #1Member
- Join Date
- Dec 2008
- Rep Power
ignore links when building file tree
I'm building file system with java trees.
I want to recognize if the file is symolic linlk - i didn't find an y methdos such as "File.isLink" - any idea how should i do it ?
otherwise its become the running time become huge.. ( I program so it will stop if there will be loops but still it take lot of time )
- 07-28-2009, 07:41 PM #2
"The fix to the faulty algorithm sounds easy: Never descend into a directory via a symbolic link. Always simply delete symlinks, no matter if they reference directories or files. With that in mind, you check the API of java.io.File for the isLink() method, just to find out... It does not exist! Right, the ability to identify links is missing and that has been an issue with Java for years. It is a problem, currently being worked on by JSR 203, but a solution will not be available till Java SE 7. So in the meantime, a work around is required and this means doing dirty work using JNI (Java Native Interface)."
Here is a link:
How to deal with filesystem softlinks/symbolic links in Java | Onyxbits
- By thangbomlennet in forum New To JavaReplies: 13Last Post: 11-03-2012, 06:31 PM
- By ExplosiveWeasel in forum Java 2DReplies: 16Last Post: 12-17-2008, 02:34 AM
- By invincible_me in forum New To JavaReplies: 2Last Post: 08-12-2008, 02:44 PM
- By madad2005 in forum New To JavaReplies: 2Last Post: 07-18-2007, 05:47 PM