开发者

FileInfo.Exists not reliable with UNC path

开发者 https://www.devze.com 2023-01-27 18:41 出处:网络
I want to determine if a UNC file exists. I create a FileInfo object, then call FileInfo.Exists. But it\'ll occasionally return false, even if the file actually exists.

I want to determine if a UNC file exists. I create a FileInfo object, then call FileInfo.Exists. But it'll occasionally return false, even if the file actually exists.

How can I accurately determine i开发者_开发百科f a UNC file exists?


You can't do this in a general sense, because as Ben mentions, you might not have ACLs to see if it exists. That being said, the best way to determine if a file exists (based on your scenario) is to attempt to open the file

0

精彩评论

暂无评论...
验证码 换一张
取 消