Click here to Skip to main content
15,886,873 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am trying to list all Directory and file of C:
I tryed with
Directory.GetDirectories(dir,"*",SearchOption.AllDirectories)

but it throwing error
System.UnauthorizedAccessException was unhandled
  Message=Access to the path 'c:\Config.Msi\' is denied.

i want my program such that it continue its search except that files which required Authentication.
Posted

1 solution

To avoid this, don't use SearchOption.AllDirectories, but write all the recursion code yourself:
http://stackoverflow.com/a/172575[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900