I have a folder with symbolic links (cmd dir
on that directory, lists these as SYMLINKD
if that makes any difference). Any time I try to call Directory.GetFiles
, Directory.GetDirectories()
or any of the other variations in DirectoryInfo
, I am given the following exception:
System.IO.DirectoryNotFoundException: Could not find a part of the path 'SYMBOLIC_LINK_PATH'.
I have also tried these with the directory prefixed by \\?\
(the "long path prefix" as mentioned here: https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file#maximum-path-length-limitation)
How do I walk the directory and delete these symbolic links? What alternatives do I have to walk the directory?
(As suggested in a comment, I have also tried Directory.GetFiles("DirectorytoSearch", "*", SearchOption.AllDirectories)
with the same result: DirectoryNotFoundException
even though the MSDN article notes that this option should "include reparse points such as .... symbolic links")