file.rename

Syntax file.rename (path, name)

Params path is a legal path name to the file, folder, or volume you wish to rename.

name is the new name.

Action Changes the name of the file, folder, or volume, leaving it in place in the directory.

Returns True

Examples file.rename ("C:\\Program Files\\Frontier\\sample.txt", "C:\\Program Files\\Frontier\\oldsample.txt")

   » true


file.rename ("System:tmp", "good stuff")

   » true

file.rename ("System:tmp", "System:Backups:good stuff")

   » false

This also produces an error because it is not legal to use file.rename to change a file's location to a different folder. Use file.move for this purpose.

Errors If you supply a file name in path and a folder name other than the one in path in the name argument, an error message is generated.

Notes Use this verb to rename a file, use file.copy or file.move to copy or move it.

See Also file.copy

file.move

Discuss