Returns a string containing the base name of the file (less any file extension), or folder in a provided path specification.
Syntax
object.GetBaseName(path)
The GetBaseName method syntax has these parts:
Part
Description
object
Required. Always the name of a FileSystemObject.
path
Required. The path specification for the file or folder whose base name is to be returned.
Remarks
The GetBaseName method returns a zero-length string ("") if no file or folder matches the path argument.
The following example illustrates use of the GetBaseName method:
Function GetTheBase(filespec)
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
GetTheBase = fso.GetBaseName(filespec)
End Function
Note The GetBaseName method works only on the provided path string. It does not attempt to resolve the path, nor does it check for the existence of the specified path.