CSplitpath:GetFolder CSplitpath:GetName

CSplitpath:GetFolder2


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

Syntax

sFolder = CSplitpath:GetFolder2()

 

    On success, this method returns a string containing the machine name, drive, and directory.

    On failure, this method returns nil.

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:GetFolder2()

-- assigns the folder component to the string sFolder

S:delete()

-- when done with S, remove it from memory

Related Topics

CSplitpath, GetFolder