List
DirectorySecurity dirSec = Directory.GetAccessControl(@"c:\test", AccessControlSections.All);
AuthorizationRuleCollection rules = dirSec.GetAccessRules(true, true, typeof(System.Security.Principal.NTAccount));
foreach (FileSystemAccessRule rule in rules)
{
ret.Add(rule.FileSystemRights);
}
ret里面就是各个帐号对该目录的访问权限,你在里面判断一下就知道了,格式是这样的:
ReadData | WriteData | AppendData | ReadExtendedAttributes | WriteExtendedAttributes | ExecuteFile | DeleteSubdirectoriesAndFiles | ReadAttributes | WriteAttributes | Delete | ReadPermissions | ChangePermissions | TakeOwnership | Synchronize