-1

How can I implement this function:

GetHost("C:\MyFolder"); //Local
GetHost("D:\MyFolder"); //Local
GetHost("\\FileServer1\MyFolder"); //FileServer1
GetHost("Y:\MyFolder"); //FileServer1
GetHost("\\LocalSharedFolder\MyOtherFolder"); //Local
GetHost("\\SpecialSharedFolder\YetAnotherFolder"); //FileServer2

Edit1:
So far i've tried juggling DirectoryInfo, DriveInfo, ManagementClass

Leonardo
  • 10,737
  • 10
  • 62
  • 155

1 Answers1

0

GetDriveType can tell me if the disk is local or not in case of "Y://". WNetGetConnection can point me the network path for it, on the case of \\LocaSharedFolder, where I can extract its host name...

Leonardo
  • 10,737
  • 10
  • 62
  • 155