ns=2;s=DEPRAG Smart/Local/FileAndDirectoryAccess/FileAccess/CopyFileTo
The command copies an existing file to a specified path. If the specified file already exists, an error is output.
In addition to the parameters already explained, the following variables must be created / transferred for the implementation in TwinCAT 3:
VAR
bFileAccessCopyFileTo : BOOL;
OutputDataFileAccessCopyFileTo : ST_VoidOutputData;
hrFileAccessCopyFileTo : HRESULT;
fbFileAccess : FB_FileAccess;
END_VAR
hrFileAccessCopyFileTo := fbFileAccess.CopyFileTo(
bExecute := bFileAccessCopyFileTo,
ConnectionHandle := depragSmartConnection.ConnectionHandle,
sfullPathSourceFile := 'C:\Test\text.txt',
sfullPathDestinationFile:= 'C:\Test2\text.txt',
OutputData => OutputDataFileAccessCopyFileTo);
IF hrFileAccessCopyFileTo <> S_FALSE THEN
bFileAccessCopyFileTo := FALSE;
END_IF
For examples and explanations regarding the calls of nodes via Siemens TIA Portal please refer to the sub-menu "Siemens TIA Portal" in section "Getting Started".