I'm trying to get the full path of a file on a server. It's on a mapped drive ie j:\0000\arch\0000-a1.dwg. I want to get something similar to \\servername\vol1:\projects\0000\arch\0000-a1.dwg. We have sevral offices with J:\drives. I want to find which server the file is on (with code).
To get started view the Net command in a dos window. You can use this in a batch file, like command>>results.txt and then read the file. Like I said it's a good way to get started and works fairly well.
Declare Function GetFullPathName Lib "kernel32.dll" Alias "GetFullPathNameA" (ByVal lpFileName As String, ByVal nBufferLength As Long, ByVal lpBuffer As String, ByVal lpFilePart As String) As Long
---------------------------------
Private Declare Function WNetGetConnection Lib "mpr.dll" Alias "WNetGetConnectionA" (ByVal lpszLocalName As String, ByVal lpszRemoteName As String, cbRemoteName As Long) As Long
Private Sub Command1_Click()
Dim Buf As String * 256, l As Long
l = 255
WNetGetConnection "s:", Buf, l
MsgBox "Full path: " & Left$(Buf, l)
End Sub
---------------------------------- Sunaj
'The gap between theory and practice is not as wide in theory as it is in practice'
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.