Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Thursday, January 8, 2015 8:19 PM
Hi,
I want to read a file "test.txt" from the server "XY" (my own PC) with the shared folder "devices$"
I want to check first whether the file exists:
FileInfo myFile = new FileInfo(@"\\XY\devices$\test.txt");
if (myFile.Exists)
Console.WriteLine("exists");
else
Console.WriteLine("does not exist");
The result is always "does not exist" even though the file exists, why??
All replies (4)
Friday, January 9, 2015 7:07 AM ✅Answered
If you can't access the file using \XY\devices$\test.txt from a window explorer then you won't be able to access it using your VS application. Either the folder isn't shared or you don't have the credentials to access the file remotely.
jdweng
Friday, January 9, 2015 9:06 AM ✅Answered
I tested your code, It works fine on my side. So i doubt whether the file exists. Please check your file. Or do you have right to access the file?
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey.
Thursday, January 8, 2015 8:56 PM
If you use a windows explorer and type same folder in URL do you see the file?
jdweng
Thursday, January 8, 2015 9:06 PM
No the file is here
C:\Users\XY\Documents\devices$\test.txt