开发者

Copy permissions from one Windows Folder to another

I need to create a small C# Windows app which copies securi开发者_如何学运维ty permissions from one folder to another. That includes copying group permissions too. What would be the best way to approach such a challenge?

Yosief Kesete


Rather than writing the whole thing yourself, why don't you get your app to run a tool like AccessChk (use the -l parameter), and then apply permissions to the target folder based on the info you parse from the output of AccessChk.


First get out the folder with DirectoryInfo then get out an instance of the DirectorySecurity class using the GetAccessControl method. Then you'll be able to call GetAccessRules and AddAccessRule which should hopefully get you started.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜