With the code below you can copy and set specific permissions to a directory within Net app.

using System.Security.AccessControl;
using System.Security.Principal;
        string sourceFolder = ConfigurationManager.AppSettings["sourceFolder"];
        string newFolder = ConfigurationManager.AppSettings["newFolder"];
        Console.WriteLine($"sourceFolder {sourceFolder}");
        
        string lastFolder = sourceFolder.Split('\\').Last();
        newFolder = Path.Combine(newFolder, lastFolder);
        Directory.Move(sourceFolder, newFolder);

        // Get security settings from the subfolder
        DirectoryInfo newDirInfo = new DirectoryInfo(newFolder);
        DirectorySecurity newFolderSecurity = newDirInfo.GetAccessControl();
        // Enable inheritance on the subfolder
        newFolderSecurity.SetAccessRuleProtection(false, false); // False = enable inheritance, True = preserve inherited rules

        // Apply the parent's security rules to the subfolder
         newDirInfo.SetAccessControl(newFolderSecurity);
        Console.WriteLine($"Folder {newFolder} security is updated");