File.SetName (gb)

Static Function SetName ( Path As String, NewName As String ) As String

Modifica a parte "nome do arquivo" de um caminho, e retorna o caminho modificado.

Examples

DIM filePath AS String

PRINT "* Um tipo de caminho padrão"
filePath = "/my/path/file.ext"
PRINT filePath
PRINT File.SetName(filePath, "novo-nome.nova")

PRINT "\\n* Novo nome sem extensão"
filePath = "/my/path/file.ext"
PRINT filePath
PRINT File.SetName(filePath, "novo-nome")

PRINT "\\n* Um caminho sem nenhum nome de arquivo"
PRINT "* Você pode acabar com um caminho inválido"
filePath = "/my/path/"
PRINT filePath
PRINT File.SetName(filePath, "novo-nome.nova")

PRINT "\\n* Um caminho com apenas um nome de arquivo"
filePath = "file.ext"
PRINT filePath
PRINT File.SetName(filePath, "novo-nome.nova")

* Um tipo de caminho padrão
/my/path/file.ext
/my/path/novo-nome.nova

* Novo nome sem extensão
/my/path/file.ext
/my/path/novo-nome

* Um caminho sem nenhum nome de arquivo
* Você pode acabar com um caminho inválido
/my/path/
/my/novo-nome.nova

* Um caminho com apenas um nome de arquivo
file.ext
novo-nome.nova