FileCopy
Description
This function block copies a file's contents to a new file. Please note that large files will take a noticeable amount of time to complete. For example, a 1000KB file takes approximately 0.6 seconds.
Figure 7-193: The FileCopy Function Block
Related Functions
FileDelete, FileRename, FileExists, FileSize
See also: File Management
Arguments
Input
Execute | Description | On the rising edgeA rising edge is the transition of a digital signal from low to high. It is also called positive edge request to perform copying a file |
Data Type | BOOL | |
Range | 0, 1 | |
Unit | N/A | |
Default | — | |
Src | Description | The path to the source file |
Data Type | STRING | |
Range | N/A | |
Unit | N/A | |
Default | — | |
Dst | Description | The destination path to the new 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
(* 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;