RENAME

Concept Link IconSee also

Rename a file.

WebVue support - Yes.

Syntax

IntVal = RENAME(OldName, NewName);

Return type: INTEGER.

Argument

Meaning

OldName

Current name of the file. Type STR.
If executed in a WebVue session context this instruction is processed by the computer that hosts the web back end and the file is renamed on that computer.

NewName

New name of the file. Type STR.
If executed in a WebVue session context this instruction is processed by the computer that hosts the web back end and the file is renamed on that computer.

Execution

Return:

1 if successful, else 0.

The file to be renamed must not be open.

File paths are relative to the project folder TP.

Example

'Before you run the program, create a file old.txt in the TP folder.

SUB Main()

If (RENAME("old.txt","new.txt")==0) Then

  'When the Rename command does not work,

  'that is because a file new.txt already exists, so delete it:

  If (UNLINK("new.txt")==1) Then

    RENAME ("old.txt","new.txt");

  Else

    'If Rename still does not work, the file may be open:

    Print("Check that the new file is not already open.");

  End If

End If

END SUB