;------------------------------------------------------------------------------------------------------------------------------------------ #DefineFunction udfPathRoot (strString) strPathRoot = "" arrPattern = Arrayize ("?:\" : @LF : "\\*\*\" : @LF : "\", @LF) For intI = 0 To 2 If 1 == StrIndexWild (strString, arrPattern [intI], 1) strPathRoot = StrSubWild (strString, arrPattern [intI], 1) If intI == 1 Then strPathRoot = StrSub (strPathRoot, 1, StrLen (strPathRoot) - 1) Break EndIf Next Return strPathRoot ;.......................................................................................................................................... ; This UDf udfPathRoot works like SHLWAPI.DLL "PathStripToRootA". ; ; Detlev Dalitz.20090630. ;.......................................................................................................................................... #EndFunction ;------------------------------------------------------------------------------------------------------------------------------------------ ; Test. strString1 = "\\SERVER\SHARE\FOLDER\FOLDER\FILE1.EXT" strString2 = "A:\FOLDER\FOLDER\FILE2.EXT" strString3 = "\FOLDER\FOLDER\FILE3.EXT" strString4 = "\FILE4.EXT" strString5 = "A:..\FILE5.EXT" strString6 = "..\FILE6.EXT" strString7 = "FILE7.EXT" strPathRoot1 = udfPathRoot (strString1) ; "\\SERVER\SHARE" strPathRoot2 = udfPathRoot (strString2) ; "A:\" strPathRoot3 = udfPathRoot (strString3) ; "\" strPathRoot4 = udfPathRoot (strString4) ; "\" strPathRoot5 = udfPathRoot (strString5) ; "" strPathRoot6 = udfPathRoot (strString6) ; "" strPathRoot7 = udfPathRoot (strString7) ; "" strFilePath1 = StrSub (FilePath (strString1), StrLen (strPathRoot1) + 1, -1) ; "\FOLDER\FOLDER\" strFilePath2 = StrSub (FilePath (strString2), StrLen (strPathRoot2) + 1, -1) ; "FOLDER\FOLDER\" strFilePath3 = StrSub (FilePath (strString3), StrLen (strPathRoot3) + 1, -1) ; "FOLDER\FOLDER\" strFilePath4 = StrSub (FilePath (strString4), StrLen (strPathRoot4) + 1, -1) ; "" strFilePath5 = StrSub (FilePath (strString5), StrLen (strPathRoot5) + 1, -1) ; "A:..\" strFilePath6 = StrSub (FilePath (strString6), StrLen (strPathRoot6) + 1, -1) ; "..\" strFilePath7 = StrSub (FilePath (strString7), StrLen (strPathRoot7) + 1, -1) ; "" strFileBaseName1 = FileBaseName (strString1) ; "FILE1.EXT" strFileBaseName2 = FileBaseName (strString2) ; "FILE2.EXT" strFileBaseName3 = FileBaseName (strString3) ; "FILE3.EXT" strFileBaseName4 = FileBaseName (strString4) ; "FILE4.EXT" strFileBaseName5 = FileBaseName (strString5) ; "FILE5.EXT" strFileBaseName6 = FileBaseName (strString6) ; "FILE6.EXT" strFileBaseName7 = FileBaseName (strString7) ; "FILE7.EXT" Exit