How can I get Directory.GetFiles() to check a networked folder?
I have the following line of code in my project:
string[] array2 = Directory.GetFiles(targetFolder, "*.zip");
The variable targetFolder is grabbed from my appSettings files and resembles:\\myNetwork\\Project\\TargetFolder\\
However, when I debug my project, Directory.GetFiles() changes it to:C:\\myNetwork\\Project\\TargetFolder\\ which is incorrect and fails.
How can I fix this?
Your network path should start with two slashes which are special characters, so you should use double on those as well:
\\\\myNetwork\\Project\\TargetFolder
Notice the four slashes in front (which actually represent two).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With