This function moves a file to another directory. The destination must be on the same drive as the source.
Input:
src : STRING
Name of the file to move. Both absolute and relative paths are allowed.
dst : STRING
The destination path of the file. Both absolute and relative paths are allowed.
Returns: INT
0
|
- File is renamed.
|
-1
|
- Media not open.
|
-2
|
- Media is not formatted.
|
-3
|
- Path to file is invalid.
|
-4
|
- Name of file (new or old) is invalid.
|
-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 fsFileMove : INT;
VAR_INPUT
src : STRING;
dst : STRING;
END_VAR;
Example:
INCLUDE rtcu.inc
PROGRAM test;
VAR
rc : INT;
END_VAR;
BEGIN
...
rc := fsFileMove(src:="\prg1.log",dst:="\folder\prg1.log");
IF rc = 0 THEN
...
ELSE
...
END_IF;
...
END;
END_PROGRAM;
|