Dim dirs As List(Of String)
dirs = New List(Of String)(IO.Directory.EnumerateDirectories(path, "*", SearchOption.AllDirectories))
The following code works fine for the most part but always fails on the c:\users\documents folder because of Junction points.
I get the following exception and stack trace.
Is there a way to exclude junction points and use EnumerateDirectories or will have to write code to manually get the directory names and ignore/handle junction points?
Exception:
{"Access to the path 'C:\Users\jkfredri\Documents\My Music' is denied."}
Stack Trace:
" at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)" & vbCrLf & " at System.IO.FileSystemEnumerableIterator1.AddSearchableDirsToStack(SearchData localSearchData)" & vbCrLf & " at System.IO.FileSystemEnumerableIterator
1.MoveNext()" & vbCrLf & " at System.Collections.Generic.List1..ctor(IEnumerable
1 collection)" & vbCrLf & " at BUDWindows.BUD.FileSystem.Directory.GetDirectoriesList(String path) in C:\Users\\Visual Studio\Projects\Desktop Applications\BUDWindows\Classes\FileSystemManager.vb:line 292"