© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•4y ago•
14 replies
euskater

System.UnauthorizedAccessException [Answered]

Hei I need help with this line

 foreach (string valid_path in Directory.EnumerateDirectories(dir, validFolderName, SearchOption.AllDirectories))
 foreach (string valid_path in Directory.EnumerateDirectories(dir, validFolderName, SearchOption.AllDirectories))


I want to search for a specific Folder in my Drive "C:\"

But it always give me access denie for C:$Recycle.Bin. I want to skip it but it doesnt work even with try cath.

Thanks for any help
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

UnauthorizedAccessException [Answered]
C#CC# / help
4y ago
filter System.string [Answered]
C#CC# / help
4y ago
System.Diagnostics.EventLog [Answered]
C#CC# / help
4y ago
System.NullReference Exception Adding to a Dictionary [Answered]
C#CC# / help
4y ago