Below you'll find the source for the Visual Basic 6 function basename.
Attribute VB_Name = "modBasename"
' This function is downloaded from:
' http://www.stefanthoolen.nl/archive/vb6-functions/
'
' You may freely distribute this file but please leave all comments, including this one, in it.
'
' @Author Stefan Thoolen <mail@stefanthoolen.nl>
Option Explicit
''
' Returns filename component of path
' Same syntax as the PHP function 'basename'
' See also: http://www.php.net/manual/en/function.basename.php
' @param Sting Path The full path
' @param Sting suffix Optional, a string that must be removed if it exists as suffix
' @return String The base filename
' @author Stefan Thoolen <mail@stefanthoolen.nl>
Public Function basename(Path As String, Optional suffix As String) As String
Dim i As Integer
i = InStrRev(Replace(Path, "\", "/"), "/")
basename = Right(Path, Len(Path) - i)
If LCase(Right(basename, Len(suffix))) = LCase(suffix) Then basename = Left(basename, Len(basename) - Len(suffix))
End Function