I've a problem with the way File.Exists()
(doesn't) work: when I use it, it claims that the file doesn't exist (from Immediate Window):
filePath
"P:\\poolman\\LY21\\2015\\LY21_2015-03-25_03.xml"
File.Exists(filePath)
false
But if I copy/paste the file path to an explorer window url (removing the escaping \
) it opens the file.
So File.Exists()
claims that an existing file doesn't exist which bug me.
It's not about the length of the path (which is 43) and FileInfo
is not a better option as suggested here.
Here's the result of the FileInfo
check:
var f = new FileInfo(filePath);
{P:\poolman\LY21\2015\LY21_2015-03-25_03.xml}
base: {P:\poolman\LY21\2015\LY21_2015-03-25_03.xml}
_name: "LY21_2015-03-25_03.xml"
Directory: {P:\poolman\LY21\2015}
DirectoryName: "P:\\poolman\\LY21\\2015"
Exists: false
IsReadOnly: true
Length: '(var f = new FileInfo(filePath);).Length' threw an exception of type 'System.IO.FileNotFoundException'
Name: "LY21_2015-03-25_03.xml"
How could I deal with it?