I am making a program where it could copy a Folder and Transfer it to another location, including the attribute, permissions, security settings.
So Far I got the Attribution to work, but am having problems with the permissions/security settings. Here are my code:
Directory.CreateDirectory(Destination);
DirectoryInfo DestAttribute = new DirectoryInfo(Destination);
DestAttribute.Attributes = Source.Attributes; // Copies Attributes from Source to Dest
AuthorizationRuleCollection Rule;
DirectorySecurity DestSecurity = Source.GetAccessControl();
Rule = DestSecurity.GetAccessRules(true, true, typeof(NTAccount));
DestSecurity.AddAccessRule(Rule);
DestAttribute.SetAccessControl(DestSecurity);
Anyone have any suggestion on getting this to work ?
Thank you everyone for all the help.
This appears to be a duplicate of:
Original Question…
(code sample from original question)
I put together the following method and it appears to do what you want…
Chris