GetParentFolderName Method

 

Description

 

Returns a string containing the name of the parent folder of the last component in a specified path.

 

PowerBASIC Syntax

 

METHOD GetParentFolderName ( _

BYVAL bstrPathSpec AS STRING _

) AS STRING

 

Arguments

 

bstrPathSpec

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

 

Return Value

 

BSTR. The name of the parent folder.

 

Remarks

 

The GetParentFolderName method returns a zero-length string ("") if there is no parent folder for the component specified in the path argument. The GetParentFolderName 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 parent name from a path

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

 

Valid XHTML 1.0 Transitional