0

I have developed an application that you enter a directory and it gives you the 10 biggest files in that location. I want to give users the ability to even do this on c:/. But with that i get an exception whenever the application tries to enter a something like c:\Program Files\WindowsApps. Below is my query. Ive tried certain ways of cantains etc. But seem to be stumped.

var subDirectories = dirInfo.GetDirectories().Where(d => (d.Attributes & FileAttributes.System) == 0);
RainMan
  • 13
  • 2
  • You would need to provide access to that directly, there's nothing you can do apart from giving enough permissions to the user running the program. – Ali Baig Jan 20 '17 at 23:47
  • What type of application?... If you have some kind of `executable` you can instruct your users to use `Run As` and then type a elevated privileges user creds... maybe that's enough, super insecure, but enough. – David Espino Jan 20 '17 at 23:50
  • See this: http://stackoverflow.com/questions/13130052/directoryinfo-enumeratefiles-causes-unauthorizedaccessexception-and-other – hcerim Jan 21 '17 at 00:16

0 Answers0