I have been asked to create an app that more or less does an archive with a few "tweaks". My problem is that before I do the copyDirectory and DeleteDirectory (yes, I want to do two steps rather than MoveDirectory), I would like to check all the file security settings for each file in the root directory (and sub-directories). I'm guessing this can be done programatically but I'm not sure how to start.
Asked
Active
Viewed 41 times
0
-
What do you want to check with regard to the file security settings? Maybe [CommonObjectSecurity.GetAccessRules(Boolean, Boolean, Type) Method](https://learn.microsoft.com/en-us/dotnet/api/system.security.accesscontrol.commonobjectsecurity.getaccessrules?view=net-7.0#system-security-accesscontrol-commonobjectsecurity-getaccessrules(system-boolean-system-boolean-system-type)) is somewhere to start. – Andrew Morton Dec 04 '22 at 13:08
-
I want to do a "pre-archive" check to see if there are going to be any problems. In this check I'd like to see if I'm going to have any problems accessing the files for the copy and/or delete. If I am going to have a problem, then I'll ask the user to fix whatever is causing the problem before we start the archive. – Ross from Brooklin Dec 04 '22 at 14:16
-
Maybe [How do I check whether File.Delete() will succeed without trying it, in C#?](https://stackoverflow.com/q/1444153/1115360) will be of use to you. – Andrew Morton Dec 04 '22 at 14:39
-
I'll take a look. I didn't mention that I'm pretty new to Visual Basic and have no experience with C#. That first link you gave me was WAY too complicated for me. – Ross from Brooklin Dec 04 '22 at 14:51