Command COPY FILE Foundation
Copies a file to a new file or to an output device.
COPY FILE <cSourceFile> TO <cTargetFile>|<cDevice>
The file command COPY FILE copies a source file to a new file or sends the contents of the source file to an output device. If the file name does not include the path, the path specified using SET DEFAULT is used as the default path. If the file <cTargetFile> already exists, it is overwritten without warning. If <cTargetFile> is an invalid file name or <cSourceFile> does not exist, a runtime error is generated.
// The example shows various calls to the command COPY FILE
PROCEDURE Main
LOCAL cSourceFile := "Test.txt"
LOCAL cTargetFile := "Temp.prn"
// call with variables
COPY FILE (cSourceFile) TO (cTargetFile)
COPY FILE Test.txt TO Temp.prn // call with literal file names
COPY FILE Temp.prn TO LPT1 // output to the device LPT1
RETURN
If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.