You can do this using the System.Security.AccessControl namespace.
System.Security.AccessControl; public static void AddDirectorySecurity(string FileName, string Account, FileSystemRights Rights, AccessControlType ControlType) {
Call example:
source share