/ comp / gb / file / setbasename
File.SetBaseName (gb)
Syntax

    STATIC FUNCTION SetBaseName ( Path AS String, NewBaseName AS String ) AS String

Sets the base name of a path, and returns the modified path.

### Examples

    DIM filePath AS String

    PRINT "* A standard type of path"
    filePath = "/my/path/file.ext"
    PRINT filePath
    PRINT File.SetBaseName(filePath, "new-name")

    PRINT "\\n* Try a path with two extensions"
    filePath = "/my/path/file.ext1.ext2"
    PRINT filePath
    PRINT File.SetBaseName(filePath, "new-name")

    PRINT "\\n* A path with just an extension"
    filePath = ".ext"
    PRINT filePath
    PRINT File.SetBaseName(filePath, "new-name")

    PRINT "\\n* A path without a file name"
    filePath = "/my/path/.ext"
    PRINT filePath
    PRINT File.SetBaseName(filePath, "new-name")

    PRINT "\\n* A path without a file name or extension"
    filePath = "/my/path/"
    PRINT filePath
    PRINT File.SetBaseName(filePath, "new-name")
    <hr>
    * A standard type of path
    /my/path/file.ext
    /my/path/new-name.ext

    * Try a path with two extensions
    /my/path/file.ext1.ext2
    /my/path/new-name.ext2

    * A path with just an extension
    .ext
    new-name.ext

    * A path without a file name
    /my/path/.ext
    /my/path/new-name.ext

    * A path without a file name or extension
    /my/path/
    /my/path/new-name