source code to get read write permission on files and folders and save in the table
Please find a source code to get read and write permission on files and folders. I was google about it but no one helped me.
Example
Output
Path Read Write ------------------------------------------------------------------------------------------------------------------------------------- C:\\WINDOWS Administrators, NT AUTHORITY\SYSTEM,Power Users, Users Users Administrators, NT AUTHORITY\SYSTEM
I want to get all th开发者_如何学JAVAe read write permission of all folders, subfolders and files which is selected by the user and save the above three columns data in sql table. How can i do this. source code to get permission is highly appreciated.
Thanks in advance
This should hopefully get you started:
Call Directory.GetAccessControl on the directory which gives you a DirectorySecurity instance that has a GetAccessRules which will give you a list of AuthorizationRule and if you cast that to FileSystemAccessRule then you should be able to get out the FileSystemRights and IdentityReference to get out the information you want.
精彩评论