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

Answers


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.


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.


Need Your Help

Why is my loading scroll not working, is it the ajax call?

php ajax jquery-ui

The plan was to add a scroll w/a loading scroll within a page. 2 problems with that: My loading scroll does not work & I'm not sure if I should use an iframe to implement the loading scroll. Ma...

iPhone: Removing Image from NSMutableArray

iphone objective-c ios xcode ipad

I am creating an app in which i am storing UIImage in NSMutableArray

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.