copy file <from-file> to <to-file>
Copies a file or directory.
- from-file
- The source file or directory.
- to-file
- The destination file or directory.
Operational mode
Use this command to copy a file or directory to a destination.
This command is optimized for configuration files and directories in that command completion refers to the /config
directory of all known system images. For example, running://config/
indicates the /config directory of the currently running system, and test-image1://config/
indicates the /config
directory of an image called test-image1. If needed, however, any other location within the file system can be specified.
A file or directory can be copied on the local machine. Only a file can be copied to and from the remote machine by using FTP, SCP, or TFTP.
The following table shows how to specify different types of file locations.
Location | Specification |
---|---|
FTP server | ftp://user:passwd@host/file where user is the username on the host, passwd is the password associated with the username, host is the host name or IP address of the FTP server, and file is the file, including the path. If you do not specify user and passwd, the system prompts you for them. |
SCP server | scp://user:passwd@host/file where user is the username on the host, passwd is the password associated with the username, host is the host name or IP address of the SCP server, and file is the file, including the path. If you do not specify user and passwd, the system prompts you for them. |
TFTP server | tftp://host/file where host is the host name or IP address of the TFTP server, and file is the file, including the path relative to the TFTP root directory. The running (active) configuration running://path/file where path is the path to the file, and file is the file. |
A binary image | image-name://path/file where image-name is the name of a binary image, path is the path to the file, and file is the file. |
The following example shows how to copy the contents of the /config/x509/
directory on the currently running system to the /config/x509/
directory of the TEST-IMAGE-1 image.
vyatta@vyatta:~$ copy file running://config/auth/x509/ to TEST-vyatta@vyatta:~$/auth/x509/
sending incremental file list
created directory /live/image/boot/TEST-IMAGE-1/live-rw/config/x509
./
ca.crt
1265 100% 0.00kB/s 0:00:00 (xfer#1, to-check=5/7)
crl.pem
568 100% 554.69kB/s 0:00:00 (xfer#2, to-check=4/7)
key
5626 100% 5.37MB/s 0:00:00 (xfer#3, to-check=3/7)
straylight-r1.crt
3632 100% 3.46MB/s 0:00:00 (xfer#4, to-check=2/7)
straylight-r1.key
891 100% 870.12kB/s 0:00:00 (xfer#5, to-check=1/7)
test.key
401 100% 391.60kB/s 0:00:00 (xfer#6, to-check=0/7)
sent 12808 bytes received 129 bytes 25874.00 bytes/sec
total size is 12383 speedup is 0.96
vyatta@vyatta:~$