Filerename, Filesize, Filetime – Campbell Scientific CR9000X Measurement and Control System User Manual
Page 387

Section 9. Program Control Instructions
FileRename
Changes the name of a file stored on the datalogger or a card.
Syntax
Result = FileRename("Device:OldName", "Device:NewName")
Remarks
The FileRename function returns "True" if the operation is successful or
"False" if it fails. If a file with the same new name already exists, the function
will fail. The FileHandle for the file must be closed (FileClose) before the file
can be renamed. If the drive location (Device) for the OldFileName and
NewFileName are different, the new file is copied to the NewFileName and
then the OldFileName is deleted.
Parameter
& Data Type
Enter
FILERENAME PARAMETERS
OldName
String in quotes
The name of the file to be renamed. It is a string entered in the format
"Device:FileName". If Device = CPU, the file is stored in datalogger memory. If Device =
CRD, the file is stored on a compact flash card. If a Device is not specified, the CPU
drive will be assumed.
NewName
Variable array
The NewFileName parameter is the new name for the file. Like the OldFileName
parameter, it is a string entered in the format "Device:FileName". If a Device is not
specified, the CPU drive will be assumed.
FileSize
Returns the size of a file handle that was created using the FileOpen function.
Syntax
Variable = FileSize(FileHandle)
Remarks
FileSize returns the size of the file referenced by the FileHandle parameter.
If FileClose is used to close the file, FileSize must appear prior to FileClose.
Once FileClose is executed, the FileHandle no longer exists.
FileTime
Returns the time the file specified by the FileHandle was created.
Syntax
Variable = FileTime(FileHandle)
Remarks
The value returned is the time, in seconds since January 1, 1990, that the file,
specified by the FileHandle parameter, was created. If the function fails it will
return -2^31. The FileHandle must be closed for this function to succeed.
If Variable is declared as Long, it can be sampled into a data table using the
NSEC data format to return a timestamp.
9-57