File.Rename

File.Rename ( 

string OldName,

string NewName )

Example 1

File.Rename("C:\\Temporary Stored\\index.txt", "C:\\Temporary Stored\\updated.txt");

Renames "index.txt" located at "C:\Temporary Stored\index.txt" to "updated.txt."

Example 2

-- Rename the specified file.
File.Rename("C:\\OldFile.ext", "C:\\NewFile.ext");

--Check to see if an error occurred.
error = Application.GetLastError();

-- If an error occurred, display the error message.
if (error ~= 0) then
    Dialog.Message("Error", _tblErrorMessages[error], MB_OK, MB_ICONEXCLAMATION);
end

Renames the file "OldFile.ext" to "NewFile.ext" and checks to see if the action failed. If it failed, the error code message is displayed in a dialog message.

See also:  Related Actions