CSplitpath:GetFilename


The GetFilename method returns the filename from a CSplitpath object. The filename includes no directory or file extension.

Syntax

sFileName = CSplitpath:GetFilename()

bullet.gif    On success, this method returns a string containing the filename.

bullet.gif    On failure, this method returns nil.

Example

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

S = new_splitpath()

-- create a CSplitpath object

S:SetPath(sPath)

-- Specify the path to be split

sFileName = S:GetFilename()

-- assigns the file name to sFileName.

S:delete()

-- when done with S, remove it from memory

Related Topics

CSplitpath class


Mira Pro x64 Script User's Guide, Copyright Ⓒ 2023 Mirametrics, Inc. All Rights Reserved.