How to (quickly) check if UNC Path is available

前端 未结 7 656
太阳男子
太阳男子 2020-12-05 06:45

How can I check if a UNC Path is available? I have the problem that the check takes about half a minute if the share is not available :

var          


        
相关标签:
7条回答
  • 2020-12-05 07:27

    In my project I use the System.IO :

    if (Directory.Exists(@"\\hostname\samba-sharename\directory")) { ...
    

    and it's pretty fast so far...

    0 讨论(0)
提交回复
热议问题