This article details how to copy files from one location to another in a Routing Engine.
Copying a file from one directory to another
In order to move files from one directory to another on a local router, use the following command:
user@host> file copy <source> <destination> Example: user@host> file copy /var/log/file1.txt /var/tmp/file1.txt
In this example, the file file1 is copied from the /var/log directory to /var/tmp
file1
/var/log
/var/tmp
Copying a file from one Routing Engine to another:
On Dual Routing Engine routers, sometimes there is a need to copy files from the primary RE to the Backup RE, and vice versa.
To copy a file in such a situation, use the following command:
user@host> file copy <source> <destination> Example From RE0 to RE1: user@host>file copy /var/tmp/jinstall-11.2R1.7-domestic-signed.tgz re1:/var/tmp/jinstall-11.2R1.7-domestic-signed.tgz
user@host> file copy <source> <destination>
In this example, when run in the primary RE, the Junos image on the primary RE is copied from the /var/tmp/ directory to the /var/tmp/ directory on the Backup RE.
/var/tmp/
For more details on how to copy configuration files from the primary RE to the Backup RE, refer to Copying a Configuration File from One Routing Engine to the Other.
Copying files from a local router to a remote host:
To copy files from the local router to a remote host, FTP or Secure Copy Protocol (SCP) can be used:
root@host> file copy filename ftp://hostname/filename Example: root@host> file copy /var/log/messages ftp://ftp.juniper.net/2012-0101-0001/messages
root@host> file copy filename ftp://hostname/filename
Example: root@host> file copy /var/log/messages ftp://ftp.juniper.net/2012-0101-0001/messages
In this example, log messages from the local router are copied to the juniper FTP server as anonymous under the directory of 2012-0101-0001.For more information please check the CLI command File copy
2020-02-17: Article reviewed for accuracy; no changes required.
2022-06-16: Fixed broken links