Some guys and I have the same folder stored in our C drives, but each in a different location. I’m trying to write the code that can access to this folder on every machine. I’ve tried "~/xx/xx", but it doesn’t work. How should I do this?
Update:
This is what I have now:
foreach (var dir in Directory.EnumerateDirectories(@"C:\", "*dataDir*", SearchOption.AllDirectories))
{
Debug.WriteLine(dir);
}
Exception: System.UnauthorizedAccessException: Access to the path 'C:\$INPLACE.~TR\' is denied.
Directory.EnumerateDirectories should work. You can do
.Single()if you’re only expecting one match.