如何获得长期的路径安全细节? [英] How do I get the security details for a long path?
问题描述
我做的一个文件服务器迁移和我正在写一个小C#应用程序,以帮助我的用户权限映射,所以我们可以把他们的用户群体。
I am doing a file server migration and I'm writing a small C# app to help me map the user permissions so we can put them in user groups.
我目前使用
Directory.GetAccessControl(path);
然而,当它到达此263字符的文件路径失败。
However it fails when it get to this 263 char file path.
无效的名称。
参数名:名称
Invalid name.
Parameter name: name
我得到同样的错误,当我使用的DirectoryInfo .GetAccessControl();
I get the same error when I use DirectoryInfo.GetAccessControl();
有一个变通或替代这一方法
Is there a work around or alternative to this method?
谢谢!
推荐答案
一个替代方案是使用 SUBST
。在命令提示符下,可以执行
One alternative is to use subst
. From a command prompt, you can execute
subst X: "D:\really really really\long path\that you can shorten"
然后在X上执行的操作:驱动器和整个起始段不会计入您的260个字符限制。
Then perform your operations on the X: drive and the whole beginning section won't count against your 260-char limit.
这篇关于如何获得长期的路径安全细节?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!