CSplitpath:SetFilenameExt


The SetFilenameExt method sets the file name and extension components of the CSplitpath object. The File name + extension is passed as a single string in the format 'filename.ext'. Use Merge to combine this component and the other components into a full path.

Syntax

bSuccess = CSplitpath:SetFilenameExt( sNameExt )

where

 

    sNameExt is the new file name and extension.

    bSuccess is the returned success code. On success it is true, otherwise false.

Example

Suppose a file exists with a full path named sPath. The following script creates a new path using a different file name and extension named sNewNameExt:

S = CSplitpath:new( sPath )

-- create a CSplitpath object for path sPath

S:SetFilenameExt( "MyFileName.tif" )

-- assign a new file name and extension

S:Merge()

-- combine the path components

Related Topics

GetFilenameExt

CSplitpath class