This command will copy data from an open file to another open file. Requirements: Two files must be open, one for reading, and the second for writing.
O 1 R /sourcefile.txt O 2 RW /destfile.txt
Copy File will copy from the current location in the source file, up to “num” bytes if specified, to the destination file (starting at the destination’s current location).
NOTE: You can interrupt the transfer at any time by sending
«ESC» (ASCII 27, HEX 0x1B).
fh2are file handles (1 - 4). Use the Free Handle command to get a free file handle.
numis the number of bytes to copy from
numis not given, or is greater than the size of
fh1, then the entire contents of
|Copy successful (setting |
|Copy successful (see below)|
|An error occurred|
response depends on the
C setting shown below.
To copy 200 bytes from the current location of handle 1 to handle 2:
B 1 2 200
To copy the entire source file to the destination file:
O 1 R /sourcefile.txt O 2 RW /destfile.txt B 1 2
To copy 600 bytes from position 12000 of handle 1, to handle 3, starting at position 50000:
O 1 R /sourcefile.txt O 3 RW /destfile.txt J 1 12000 J 3 50000 B 1 3 600
To copy the entirety of handle 1 to the end of handle 2 (appended):
O 1 R /sourcefile.txt O 2 RW /destfile.txt J 2 E B 1 2
or (note that the destination file is opened for append)
O 1 R /sourcefile.txt O 2 A /destfile.txt B 1 2