Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Any API call to get the Base path from a UNC path?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00180686
Message ID:
00180785
Vues:
18
>Hi folks,
>
>I need to now if there is an API call that can return a base path from a UNC path?
>
>ie:
>
>UNC path: \\continuum\putz\recon\recon_check.dbf
>Returning Base path: d:\putz\recon\recon_check.dbf
>
>By Base path, I am referring to the actual path in that particular workstation/server.

IOW, you want to know what, if any, local resource points at the UNC? the easiest way to do this would be to use WNetGetConnection() to retrieve the UNC for each drive that's a network drive, and compare the UNC returned to your UNC. It's entirely possible that there's no drive currently mapped to that base UNC, so you'd have to map a drive to find it. Your best bet would be to use the Wscript.Network object to spit out a list of UNCs currently mapped:
cUNCToTest = '\\Myserver\Myshare\somepath\somefile.xyz'
oNet = CREATEOBJ('Wscript.Network')
oUNCCollection = oNet.EnumNetworkDrives
LOCAL nCtr, cPath 
cPath = ''
FOR nCtr = 0 TO oUNCCollection.Count - 1
   IF UPPER(cUNCToTest) = UPPER(oUNCCollection.Item[nCtr + 1])
      cPath = oUNCCollection.Item[nCtr] + ;
              SUBST(cUNCToTest,LEN(oUNCCollection.Item[nCtr + 1]) + 1)
      EXIT
   ENDIF
ENDFOR
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform