java - How to protect Files.walk from symbolic links recursion? -


how protect files.walk symbolic links recursion? using java or shell.

okay, follow links.

stream<path> stream = walk(startpath, maxdepth, filevisitoption.follow_links); 

however check every directory whether symbolic link:

files.issymboliclink(path) && fles.isdirectory(path) 

use

path realpath = path.torealpath(); 

then keeping list of directories on in, ancestors, 1 prevent recursion. doing every directory check in ancestors, when symbolic link somewhere in list/current path.

a > b > start:c > d > e > symbolic:f=a > b > c 

(this still not prevent visiting directory twice, same or subdirectory linked without recursion.)


Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -