简体   繁体   English

将权限从一个Windows文件夹复制到另一个

[英]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. 我需要创建一个小的C#Windows应用程序,它将安全权限从一个文件夹复制到另一个文件夹。 That includes copying group permissions too. 这也包括复制组权限。 What would be the best way to approach such a challenge? 应对这种挑战的最佳方法是什么?

Yosief Kesete 约瑟夫·基塞特(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. 首先使用DirectoryInfo获取文件夹,然后使用GetAccessControl方法获取DirectorySecurity类的实例。 Then you'll be able to call GetAccessRules and AddAccessRule which should hopefully get you started. 然后,您将能够调用GetAccessRulesAddAccessRule ,它们有望使您入门。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 将权限从一个用户复制到另一用户-SharePoint - Copy permissions from one user to another user - SharePoint 使用 web 服务将文件从一个服务器文件夹复制到另一个文件夹 - Copy a file from one server folder to another folder using webservice 从Windows文件夹中删除权限 - Remove permissions from a windows folder 如何在C#中将文件从一个文件夹复制到另一个文件夹? - How to copy file from one folder to another in C#? C#将文件从一个文件夹复制到另一个文件夹而不重复 - C# to copy files from one folder to another without duplicates 在 Windows 窗体应用程序中将数据从一个 OleDb 数据库复制到另一个数据库 - Copy data from one OleDb database to another in Windows Forms App 如何使用Windows Service C#将文件从文件夹复制到另一个文件夹 - How to copy file from folder to another folder with Windows Service C# Sharepoint 2013服务器对象模型。 在网站创建期间将权限从一个网站复制到另一个网站 - Sharepoint 2013 Server Object Model. Copy permissions from one site to another during site creation 如何使用C#从一个路径复制文件夹并将其粘贴到另一路径? - How to copy a folder from one one path and paste it to another path using C#? 如何将多个文件夹复制到另一个文件夹? - How to copy more than one folder into another folder?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM