This will rename a file.
Input:
name_old : STRING
Name of the file to rename. Both absolute and relative paths are allowed.
name_new : STRING
The new name of the file. No path information can be included in the new name as the file remains at the same path.
Returns: INT
0
|
- File is renamed.
|
-1
|
- Media not open.
|
-2
|
- Media is not formatted.
|
-3
|
- Path to file invalid.
|
-4
|
- Name of file (new or old) is illegal.
|
-5
|
- File not found.
|
-6
|
- A file with this name already exist.
|
-12
|
- File is open.
|
-16
|
- Media not present.
|
-17
|
- Media communication error (card not supported)
|
-22
|
- Media is busy
|
-23
|
- Media is write protected.
|
-24
|
- Unknown file system.
|
Declaration:
FUNCTION fsFileRename : INT;
VAR_INPUT
name_old : STRING;
name_new : STRING;
END_VAR;
Example:
INCLUDE rtcu.inc
PROGRAM test;
VAR
rc : INT;
END_VAR;
BEGIN
...
rc := fsFileRename(name_old := "\prg1.log", name_new := "prg2.log");
IF rc = 0 THEN
...
ELSE
...
END_IF;
...
END;
END_PROGRAM;
|