C:\winnt\profiles\........\F0860 C~1
from the VB command() statement..
I want to extract out a folder name like this:
"F0860 Con"
I will use this logic to get rid of the rest of path.. but I need to get the
real path name:
right(FilePath, len(filepath) - InstrRev(FilePath, "\") )
Thanks,
Tom Bonnes
It looks like I found my answer at the Microsoft site. This VB routine
seems to work good for me. I read in Applemans book that the API has some
big problems in VB, so this is the best fix..
Tom
=======================================
Function GetLongFN(ByVal sShortName As String) As String
Dim sLongName As String, sTemp As String, iSlashPos As Integer
'Add \ to short name to prevent Instr from failing
sShortName = sShortName & "\"
'Start from 4 to ignore the "[Drive Letter]:\" characters
iSlashPos = InStr(4, sShortName, "\")
'Pull out each string between \ character for conversion
While iSlashPos
sTemp = Dir(Left$(sShortName, iSlashPos - 1), vbNormal +
vbHidden + vbSystem + vbDirectory)
If sTemp = "" Then 'Error 52 - Bad File Name or
Number
GetLongFN = ""
Exit Function
End If
sLongName = sLongName & "\" & sTemp
iSlashPos = InStr(iSlashPos + 1, sShortName, "\")
Wend
'Prefix with the drive letter
GetLongFN = Left$(sShortName, 2) & sLongName
End Function
=================================