我想创建我的机器上的文件夹到其他m/c的共享驱动器的符号链接
即如果我有'测试'文件夹在D驱动器。我想在共享文件夹上创建符号链接,例如“\\ hjds22 \ Test”。当我尝试使用下面的代码时,它给了我java.nio.file.AccessDeniedException
。
守则如下:如何用Java创建Windows符号链接(到UNC路径)
Path newLink =Paths.get("\\\\hjds22\\Test\\newLink");
Path target = Paths.get("D:\\test");
try {
Files.createSymbolicLink(newLink, target);
} catch (IOException x) {
System.err.println(x);
} catch (UnsupportedOperationException x) {
// Some file systems do not support symbolic links.
System.err.println(x);
}
注:我对共享文件夹full rights
。我还在两个m/c上执行了fsutil behavior set SymlinkEvaluation L2L:1 R2R:1 L2R:1 R2L:1
。
什么是例外?驱动器是NTFS吗? – TJR