/ comp / gb / file / setname
File.SetName (gb)
Syntax

    STATIC FUNCTION SetName ( Path AS String, NewName AS String ) AS String

Sets the file name part 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.SetName(filePath, "new-name.new")

    PRINT "\\n* No extension in new name"
    filePath = "/my/path/file.ext"
    PRINT filePath
    PRINT File.SetName(filePath, "new-name")

    PRINT "\\n* A path with no file name"
    PRINT "* You could end up with an invalid path"
    filePath = "/my/path/"
    PRINT filePath
    PRINT File.SetName(filePath, "new-name.new")

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

    * No extension in new name
    /my/path/file.ext
    /my/path/new-name

    * A path with no file name
    * You could end up with an invalid path
    /my/path/
    /my/new-name.new

    * A path with only a file name
    file.ext
    new-name.new