FileCopy
Function Block - Copies a file's contents to a new file.
Inputs
Input |
Data Type |
Range |
Unit |
Default |
Description |
---|---|---|---|---|---|
Execute |
BOOL |
0 to 1 |
N/A |
No default |
On the rising edge, request to perform copying a file. |
Src |
STRING |
N/A |
N/A |
No default |
The path to the source file. |
Dst |
STRING |
N/A |
User units |
No default |
The destination path to the source file. |
Outputs
Output |
Data Type |
Range |
Unit |
Description |
---|---|---|---|---|
Done |
BOOL |
|
|
If TRUE, the command completed successfully. |
Error |
BOOL |
|
|
If TRUE, an error has occurred. |
ErrorID |
DINT |
|
|
Indicates the error if Error output is TRUE. See the table in File and TCP/IP Function Block ErrorIDs. |
Remarks
- Large files take a noticeable amount of time to complete.
- Example: A 1000KB file takes approximately 0.6 seconds.
Figure 1: FileCopy
FBD Language Example
Not available.
FFLD Language Example
Not available.
IL Language Example
Not available.
ST Language Example
(* FileCopy example *)
CASE StepCounter OF
0:
Inst_FileCopy(TRUE, 'Source.txt', 'Dest.txt');
StepCounter := StepCounter + 1;
1:
Inst_FileCopy(TRUE, 'Source.txt', 'Dest.txt');
IF Inst_FileCopy.Done THEN
Inst_FileCopy(FALSE, '', '');
StepCounter := StepCounter + 1;
END_IF;
END_CASE;
See Also