This function copies a file i_sSourcefilename from device\\folder A to device\\folder B i_sDestinationfilename (name of the destination file). If the destination file already exists, the file is not copied.
You can copy files to the following devices:
ide0:
ram0:
own devices
Files can also be copied to RemoteDevices. The default device is "ide0:".
You must specify the device names except for the default device name in i_sSourcefilename and i_sDestinationfilename. Separate the device name and the file name by a backslash "\". You must specify a source and a destination file. You must specify the folder names in the file name of the source and destination files. There is no folder name for the root directory. The destination folders must already exist. No new destination folders are created. i_sSourcefilename and i_sDestinationfilename do not permit any wildcards. System files are not deleted. This means that system files cannot be specified as destination files for copying. However, system files may be copied into a destination file with another name.
Also refer to controller-specific system files and general system files.
The function FC_CopyFile() returns 0 if the process was successful. If an error is detected, a negative value is returned as a result. The duration of the copy process depends on the size of the file to be copied and the data memory used. When using a CompactFlash, runtime is typically 10 ms. When using network drives via RemoteDevice, copying a file can take a few seconds.
Input |
Data type |
Description |
---|---|---|
i_sSourceFilename |
STRING[80] |
File name of the source file |
i_sDestinationFilename |
STRING[80] |
File name of the destination file |
Data type |
Description |
---|---|
DINT |
0: Copy process was successful -1: Copy process unsuccessful, destination file exists already -2: Source file does not exist -4: Wildcard in "i_sSourceFilename " and/or "i_sDestinationFilename" -5: The destination file is a system file -6: Copying operation unsuccessful, general error |
FC_CopyFile ('ide0:\test.txt', 'ide0:\testneu.txt');
Copies the "test.txt" file from the "ide0:" device to the "testneu.txt" file on the "ide0:" device.
FC_CopyFile ('test.txt', 'testneu.txt');
Copies the "test.txt" file from the "ide0:" device to the "testneu.txt" file on the "ide0:" device.
FC_CopyFile ('ide0:\test.txt', 'ide0:\testdir\test.txt');
Copies the "test.txt" file from device "ide0:" to the "testneu.txt" file on device "ide0:" in the "testdir" folder. The "testdir" folder must already exist.
FC_CopyFile ('ide0:\test.txt', 'ide0:\test.txt');
Detected error: The file cannot be copied to itself.
FC_CopyFile ('ide0:\test.txt', 'ram0:\test.txt');
Copies the "test.txt" file from device "ide0:" to the "test.txt" file on device "ram0:"
FC_CopyFile(''test.out,'max4.out);
Detected error: Destination file is a system file.
FC_CopyFile('max4.out','test4.out');
Copies the firmware to the "tes4t.out" file on device "ide0:".
FC_CopyFile'ide0:\*.txt', 'ram0:\test.txt');
Detected error: Wildcard in the file name.