CSplitpath:delete CSplitpath:GetDrive

CSplitpath:GetDir


The GetDir method returns the directory name from a CSplitpath object. The directory name does not include the machine name, drive name, file name, or extension.

Syntax

sDirectory = CSplitpath:GetDir()

 

 

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

    On failure, this method returns nil.

Example

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

 

S = CSplitpath:new()

-- create a CSplitpath object

S:SetPath(sPath)

-- specify the path to be split

sDir = S:GetDir()

-- assigns the directory component to the string sDir.

S:delete()

-- when done with S, remove it from memory

Related Topics

CSplitpath, SetDir