RenameFile()


Changes the name of a file.

Syntax

RenameFile(<cOldName>, <cNewName>) --> lResult

Arguments

<cOldFile> --> is the name of the file to rename, including the file extension. A drive letter and/or path name may also be included as part of the filename.

<cNewFile> --> is the new name of the file, including the file extension. A drive letter and/or path name may also be included as part of the file name.

Returns

Returns TRUE if the rename operation was successful, otherwise FALSE.

Description

RenameFile() is a file function that changes the name of a specified file to a new name. When RenameFile() is called, <cOldFile> is renamed only if it is located in the current operating system directory or in the specified path. To ensure that the file is successfully renamed, include the path as part of the file name.

If the source directory is different from the target directory, the file moves to the target directory. In the instance that either <cNewFile> exists or is currently open, RenameFile() fails and returns FALSE, indicating that the rename operation was not successful.

generate/mistake3.gif

Example

RenameFile("C:\CAPITAL\mydata.dat", "C:\CAPITAL\newdata.dat")

____________________________

Related Topics:

Business Function List



CAPITAL VISUAL BUILDER