CSplitpath:GetFilenameExt CSplitpath:GetFolder2

CSplitpath:GetFolder


The GetFolder method returns the folder name from a CSplitpath object. The returned string includes the machine name, drive name, and directory. The string is terminated by a backslash character, \.To return the folder without a terminal backslash, use GetFolder2() instead.

Syntax

sFolder = CSplitpath:GetFolder()

 

Example

Suppose a file exists with a full path named sPath. The following script fragment retrieves the folder component:

 

S = CSplitpath:new()

-- create a CSplitpath object

S:SetPath(sPath)

-- Specify the path to be split

sFolder = S:GetFolder()

-- assigns the folder component to the string sFolder

S:delete()

-- when done with S, remove it from memory

Related Topics

CSplitpath, GetFolder2