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

where

 

    sFolder is a string containing the machine name, drive, and directory, with a trailing backslash character. On failure, nil is returned.

Example

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

S = CSplitpath:new( sPath )

-- create a CSplitpath object for path sPath

sFolder = S:GetFolder()

-- returns the folder component

S:delete()

-- when done with S, remove it from memory

Related Topics

GetFolder2

CSplitpath class