Home > comp > gb > file > setbasename 
  [3.0]
 fr de es it nl pl pt pt_BR mk sq ca ar fa vi ja ru zh zh_TW eo
Previous  Next  Edit  Rename  Undo  Refresh  Search  Administration  
Documentation
History
 
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")


* 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