jeudi 9 avril 2015

Best way to change security settings for all subfolders and files for specified folder

As far as I understand a DirectoryInfo.SetAccessControl doesn't set permissions settings for all existing sub-folders for specified folder. Instead of that, this method allows us to change permissions for folder itself and for new sub-folders. The question is: is there a way to change permissions for all sub-folders, files and for folder itself? I've been trying to found the better way than recursive traversal, because this way requires handling cases when we don't have an access to one of sub-folders or files. Moreover, it seems to me a bit clumsy. However, I assume that Windows uses this way. Could somebody explain me what the best practices are for this? Thank you.


Aucun commentaire:

Enregistrer un commentaire