FileRename
Description
This function block renames a file.
Figure 7-212: The FileRename Function Block
Related Functions
FileCopy, FileDelete, FileExists, FileSize
See also: File Management
Arguments
Input
Execute | Description | On the rising edge A rising edge is the transition of a digital signal from low to high. It is also called positive edge request to rename a file |
Data Type | BOOL | |
Range | 0, 1 | |
Unit | N/A | |
Default | — | |
Path | Description | The path to the file to be renamed |
Data Type | STRING | |
Range | N/A | |
Unit | N/A | |
Default | — | |
NewName | Description | The new name of the file |
Data Type | STRING | |
Range | N/A | |
Unit | user units | |
Default | — |
Output
Done | Description | If TRUE, then the command completed successfully |
Data Type | BOOL | |
Error | Description | If TRUE, an error has occurred |
Data Type | BOOL | |
ErrorID | Description | Indicates the error if Error output is set to TRUE. See the table in Search IndexFile and TCP/IP Function Block ErrorID Output |
Data Type | DINT |
Example
Structured Text
(* FileRename example *)
CASE StepCounter OF
0:
Inst_FileRename(TRUE, 'Original.txt', 'Renamed.txt');
StepCounter := StepCounter + 1;
1:
Inst_FileRename(TRUE, 'Original.txt', 'Renamed.txt');
IF Inst_FileRename.Done THEN
Inst_FileRename(FALSE, '', '');
StepCounter := StepCounter + 1;
END_IF;
END_CASE;