22.11.6.1 File Copy

You can copy or move files and folders in external storage.

Copy or move the file or folder defined in parameter 1 to the file or folder in parameter 2.

You can define whether or not to overwrite when the same named file or folder exists in the destination. You can also include subfolders.

_FileCopy(Source folder name/file name, Target folder name/file name, Mode1, Mode2)

Example expression:

_FileCopy("\USB\DATA\DATA0001.BIN", "\CF\BACKUP\DATA0001.BIN", 0, 0)

In the above example, the GP3000 series unit uses USB storage. From its \DATA folder, the copy function copies the "DATA0001.BIN" file to the CF card's \BACKUP folder, without overwriting.

By using an internal device in parameter 1 or 2, you can indirectly specify the copied file or folder and the destination file or folder.

Defining the file name with an internal device

_FileCopy([w:[INTERNAL]LS0100], [w:[INTERNAL]LS0200], 0, 0)

The above expression reads the values in LS0100 and and LS0200, then copies the file defined in LS0100 to the destination folder defined in LS0200.

 

File Copy Status

You can check the file copy status by reading internal device LS9160. When an error occurs while copying, the error code is saved and the copy operation is halted.

Bit 12 to 15

Description

Details

0

Completed Successfully

The process completed successfully.

1

Completed Successfully (Overwrite)

When copying a folder or copying mulitple files, although the process completed successfully, files failed to copy because the Copy Operation was set to Do Not Overwrite.

2

Parameter error

There is an error in the parameter definition.

3

Reserved

-

4

No CF/SD card

The CF/SC Card is not inserted in the display unit, or the CF Card cover is not closed.

5

Read Error

Reading from external storage failed.

The source file or folder does not exist.

6

Write Error

Writing data to external storage failed or there is not enough free space.

Copying a single file with Mode 1 set to Do Not Overwrite, and a file with the same name already exists in the destination.

Copying a single file with Parameter 3 (Mode 1) set to Overwrite or Cut, and a read-only file with the same name already exists in the destination.

Copying a folder or multiple files, files failed to copy because some files are read-only.

SD card is write protected.

7

CF Card Error

The CF card is invalid, unformatted, or the format is incorrect and cannot be used.

8

Delete Error

When Mode 1 is Cut, the source file is read-only or unable to delete the source file.

SD card is write protected

9-13

Reserved

-

14

No USB Storage

There is no USB storage device inserted into the display unit.

15

USB storage error

USB storage is invalid, unformatted, or the format is incorrect and cannot be used.