Setting ACE
is very slow for folder with many files and subfolders. My folder has 35602 files and 648 subfolders and SetAccessControl method needs 30 minuteto remove a userfrom this folder.
I am removing a
userfrom the security tab of folder using following code.
DirectoryInfo dirInfo
= new DirectoryInfo(folderPath); DirectorySecurity fSecurity = dirInfo.GetAccessControl(AccessControlSections.All); fSecurity = CanonicalizeDacl(fSecurity);
fSecurity
.RemoveAccessRule(new FileSystemAccessRule(coworkerAccount, accessRight, AccessControlType.Allow));
dirInfo
.SetAccessControl(fSecurity);
SetAccessControl method takes a long
timewhen the folder having many files.
v