简体   繁体   中英

Copy permissions from one Windows Folder to another

I need to create a small C# Windows app which copies security 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

而不是自己编写整个内容,为什么不让您的应用运行诸如AccessChk之类的工具(使用-l参数),然后根据您从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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM