3 file control, Fileclose, Filecopy – Campbell Scientific CR9000X Measurement and Control System User Manual
Page 383: Filelist

Section 9. Program Control Instructions
9.3 File Control
FileClose
Closes a FileHandle created by FileOpen.
Syntax
Result = FileClose(FileHandle)
Remarks
This function returns 0 if successful. A non-zero result means there was an
error in closing the FileHandle. An error code of 17 means the FileHandle did
not exist. FileHandle is the variable that was created by the FileOpen
instruction.
FileCopy
Used to copy a file from one drive on the datalogger to another.
Syntax
Result = FileCopy("FromFileName", "ToFileName")
Remarks
The FileCopy function returns True if the operation is successful or False if it
fails. If a file with the same name already exists, the existing file will be
overwritten. The FileHandle for the file must be closed, using FileClose
before the file can be copied.
Parameter
& Data Type
Enter
FILECOPY PARAMETERS
FromFileName
String
The location drive and name of the file to be copied. It is a string entered in the format
"Device:FileName". If Device = CPU, the file is copied from datalogger memory. If
Device = CRD, the file is copied from a compact flash card. If a Device is not specified,
the CPU drive will be assumed.
ToFileName
String
The destination (drive) and name for the copied file. Like the FromFileName parameter, it
is a string entered in the format "Device:FileName". If Device is not specified, the CPU
drive will be assumed.
FileList
Returns a list of files that exist on the specified drive.
Syntax
Variable = FileList("Device", Dest)
9-53