在PowerShell中,我需要解析联结的目标路径(符号链接).
例如,假设我有一个c:\someJunction目标是的交叉点c:\temp\target
我试过各种变化$junc = Get-Item c:\someJunction,但只能得到c:\someJunction
在本例中c:\temp\target,如何找到给定连接点的目标路径?
从高级别的角度来看(意味着只关心结果和界面,而不是实现),指向目录的NTFS重分析点与指向目录的符号链接之间的行为有何不同(如果有的话)同一目录?
它们是否在堆栈中的同一级别上解析,或者在另一个可以解析的某个时间(如启动时)是否可能无法解析?
(我知道符号链接也适用于文件,但我在这里询问目录的区别.)
我一直在谷歌搜索这个我可能有一些脑云,因为它不起作用.
我需要检测文件夹是否是一个联结,所以我的递归文件搜索不会运行到无限循环.
我可以使用像这样的简单函数
IsJunction(attr: dword): boolean;
Run Code Online (Sandbox Code Playgroud)
其中attr dwFileAttributes来自TWin32FindData;
我似乎无法让它工作.谢谢!
有没有办法在Python中创建NTFS交接点?我知道我可以调用该junction实用程序,但最好不要依赖外部工具.
我想快速检查是否在完整路径中使用了连接点.我已经有一个测试文件夹的功能,IsJunction()但也许还有一个其他解决方案不能调用IsJunction()每个子文件夹.
所以我正在寻找一个HasJunctionsInPath(string path)没有测试路径的每个文件夹的功能.
有什么能做到这一点吗?
编辑:
或更好...
是否可以解析路径中的所有联结以获取文件或文件夹的真实位置?这样可以更好地解决我的问题,我仍然可以将结果与实现bool HasJunctionsInPath(string path)函数的原始路径进行比较.
There is CreateHardLink function to create Hardlinks.(Since Win2000)
And there is CreateSymbolicLink function since Vista has been released.
But why isn't there a CreateJunction?
How does mklink make a junction?
And How do I write codes to make junction in my app?
定义一个联结my $j = 1 | 2 | 3 | 4 | 5,现在我想获得它的值数组[1 2 3 4 5],我应该如何实现呢?
我试过$j.values但是Perl6给了我整个交叉点作为一个元素:[any((1), (2), (3), (4), (5))].
I've been trying to figure out a way to get some sort of ability to be able to return the true abspath of a symbolic link in Windows, under Python 2.7. (I cannot upgrade to 3.x, as most DCCs such as Maya/3ds max do not use that version of Python)
I've looked at the sid0 ntfs utils (whose islink() function works, but readlink() function always returns an empty unicode string for me for some reason), and the juntalis ntfs libs …
有时我有一个很长的列表,我想检查一个字符串是否匹配列表中的任何内容.我试图在正则表达式内插入一个结点.他们都是错误.
say "12345" ~~ m/ <{ (2,3,4).any }> /
Cannot resolve caller MAKE_REGEX(Int, Bool, Bool, Int, PseudoStash); none of these signatures match:
say "12345" ~~ m/ $( (2,3,4).any ) /
This type cannot unbox to a native string: P6opaque, Junction
Run Code Online (Sandbox Code Playgroud)
此错误消息是否表示无法在正则表达式插值中使用联结?
我的解决方法是
say "12345" ~~ m/ <{ (2,3,4).join("||") }> /
?2?
Run Code Online (Sandbox Code Playgroud)
有关在正则表达式插值中使用连接的任何建议吗?
非常感谢你 !!!
lisprog
只是为了它,我试图用raku 中的运算符(在该页面上搜索)匹配正则表达式的连接点。m// Explicit topic match
在perl6REPL 中:
> any('a','b') ~~ m/./
False
Run Code Online (Sandbox Code Playgroud)
之后,无论我怎么称呼,m//我都会收到一个不可变的匹配投诉:
> 'x' ~~ m/./
Cannot modify an immutable Match (?a?)
in block <unit> at <unknown file> line 1
Run Code Online (Sandbox Code Playgroud)
题
这里的幕后发生了什么?
讨论
问题似乎源于将$/ 特殊变量设置为结点
any(?a?, ?b?)
Run Code Online (Sandbox Code Playgroud)
在路口比赛之后,似乎是?a?在路口引起了投诉。
只要我做任何改变$/其他事情的事情,功能就会恢复:
> $/=Any
(Any)
> 'x' ~~ m/./
?x?
Run Code Online (Sandbox Code Playgroud)
或者
> 'x' ~~ /./
?x?
> 'x' ~~ m/./
?x?
Run Code Online (Sandbox Code Playgroud)
(所以先匹配//,以便改变$/,然后 …