GetBaseName Method

 

Description

 

Returns a string containing the base name of the last component, less any file extension, in a path.

 

PowerBASIC Syntax

 

METHOD GetBaseName ( _

BYVAL bstrPathSpec AS STRING _

) AS STRING

 

Arguments

 

bstrPathSpec

BSTR. The path specification for the component whose base name is to be returned.

 

Return Value

 

BSTR. The base name.

 

Remarks

 

The GetBaseName method returns a zero-length string ("") if no component matches the path argument. 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.

 

Example [PowerBASIC]

 

#INCLUDE "windows.inc"

#INCLUDE "scrrun.inc"

 

DIM fso AS IFileSystem

DIM strName AS STRING

 

' Create an instance of the FileSystemObject

fso = NEWCOM "Scripting.FileSystemObject"

' Get the base path name from a path

strName = fso.GetBaseName (UCODE$("C:\MyFolder\Test.txt"))

 

Valid XHTML 1.0 Transitional