C#: Set directory's owner and propagate the changes

666 views Asked by At

I'm setting a directory's owner via C#:

var acl = new DirectorySecurity(path, AccessControlSections.Owner);
acl.SetOwner("domain\username");
Directory.SetAccessControl(path, acl);

This works well, except for one thing: It doesn't propagate to child folders. Is there a way to make this change propagate, except for recursively iterating through all subfolders and files and manually setting the owner?

0

There are 0 answers