Setting ACE is very slow for folder with many files and subfolders.
-
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 minute to remove a user from this folder. I am removing a user from 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 time when the folder having many files.
Mahendra
-
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 minute to remove a user from this folder. I am removing a user from 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 time when the folder having many files.
Mahendra
sumB wrote:
SetAccessControl method takes a long time when the folder having many files.
That is inevitable. Each file takes a finite amount of time, multiply that by 35602, plust the time taken to traverse 648 subdirectories, and you get a larger finite time.
Veni, vidi, abiit domum
-
sumB wrote:
SetAccessControl method takes a long time when the folder having many files.
That is inevitable. Each file takes a finite amount of time, multiply that by 35602, plust the time taken to traverse 648 subdirectories, and you get a larger finite time.
Veni, vidi, abiit domum
-
Yes, I understand you concern but do we have any technique to overcome the time issue.
Mahendra
The typical way I was taught in my days as an administrator was to use groups for file access rights. All that would be needed to remove an account from accessing the files was to remove them from the group, which in itsself is a quite speedy process. There is also nothing preventing you from having just a single account in such a group. The group access rights can be removed by some background process then after the last account from the group has been removed. Still, removing an account from that group will immeadiately keep that account from accessing the files. Hope that will help you in the future. Cheers!
"I had the right to remain silent, but I didn't have the ability!"
Ron White, Comedian