Results 1 to 2 of 2

Thread: Convert file names to/from UNC

  1. #1

    Thread Starter
    Member
    Join Date
    Jun 2000
    Posts
    63

    Post

    Does anyone out there know how to get the full UNC path of a file name that is reference by its logical drive, and vice versa.
    Eg. i:\windows --> \\server1\install\windows
    \\server2\data --> g:\

  2. #2
    Frenzied Member Buzby's Avatar
    Join Date
    Jan 1999
    Location
    UK
    Posts
    1,670
    I don't think there's a built-in function but this may help point you in the right direction - the FSO (File System Object) is very handy for file/drive related stuff. In order to use it you will need to go to PROJECT / REFERENCES and add Microsoft Scripting Runtime (SCRRUN.DLL)

    Code:
    Dim fso As New FileSystemObject
    Dim fDrive As Drive
    
    For Each fDrive In fso.Drives
        Debug.Print fDrive.ShareName, fDrive.Path, Choose(fDrive.DriveType + 1, "Unknown", "Removable", "Fixed", "Remote", "CDROM", "RAM")
    Next

    'Buzby'
    Visual Basic Developer
    "I'm moving to Theory. Everything works there."

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width