copy
To copy any file from a source to a destination, use the copy command.
How to: Download files with FTP.; 2 minutes to read +2; In this article. This sample shows how to download a file from an FTP server. Example using System; using System.IO; using System.Net; namespace Examples.System.Net public class WebRequestGetExample public static void Main // Get the object used to communicate with the.
copysource-url destination-url
Syntax Description
Location URL (or variable) of the source file or directory to be copied. The source can be either local or remote, depending upon whether the file is being downloaded or uploaded. For more information, see the 'Usage Guidelines' section. |
Destination URL (or variable) of the copied file or directory. The destination can be either local or remote, depending upon whether the file is being downloaded or uploaded. For more information, see the 'Usage Guidelines' section. |
Command Default
The default name for the destination file is the source filename.
Command History
Modification |
---|
This command was introduced. |
Support for this command was introduced on external Universal Serial Bus (USB) Flash memory devices. |
Usage Guidelines
The copy command allows you to copy a file (such as a system image or configuration file) from one location to another location. The source and destination for the file is specified using a Cisco NX-OS file system URL, which allows you to specify a local or remote file location. The file system being used (such as a local memory source or a remote server) determines the syntax used in the command.
You can enter on the command line all necessary source- and destination-URL information and the username to use, or you can enter the copy command and have the CLI prompt you for any missing information.
The entire copying process may take several minutes, depending on the network conditions and the size of the file, and differs from protocol to protocol and from network to network.
The colon character (:) is required after the file system URL prefix keywords (such as bootflash).
In the URL syntax for ftp:, scp:, sftp:, and tftp:, the server is either an IPv4 address or a hostname.
![How to use sftp How to use sftp](/uploads/1/2/6/3/126338756/426833475.png)
Format of Source and Destination URL
The format of the source and destination URLs varies according to the file or directory location. You can enter either a command-line interface (CLI) variable for a directory or a filename that follows the Cisco NX-OS file system syntax (filesystem:[/directory][/filename]).
The following tables list URL prefix keywords by the file system type. If you do not specify a URL prefix keyword, the switch looks for a file in the current directory.
Source or Destination |
---|
Source or destination URL for boot flash memory. The server argument value is module-1, sup-1, sup-active, or sup-local. |
Source or destination URL of the default internal file system. Any files or directories stored in this file system will be erased when the switch reboots. The server argument value is module-1, sup-1, sup-active, or sup-local. |
Source or Destination | |
---|---|
Source or destination URL for a FTP network server. The syntax for this alias is as follows: | |
scp: | Source or destination URL for a network server that supports Secure Shell (SSH) and accepts copies of files using the secure copy protocol (scp). The syntax for this alias is as follows: |
sftp: | Source or destination URL for an SSH FTP (SFTP) network server. The syntax for this alias is as follows: |
tftp: | Source or destination URL for a TFTP network server. The syntax for this alias is as follows: |
Source or Destination |
---|
Local memory for core files. You can copy core files from the core file system. |
Local memory for debug files. You can copy core files from the debug file system. |
Local memory for log files. You can copy log files from the log file system. |
External memory for mod files. You can copy mod files from modflash file system. |
Local system memory. You can copy the running configuration to or from the system file system. The system file system is optional when referencing the running-config file in a command. |
Source or destination URL for the external Universal Serial Bus (USB) Flash memory devices. You can copy the kickstart and system image to bootflash. Note This is applicable only to the Cisco Nexus 5500 Series switches. |
Local volatile memory. You can copy files to or from the volatile file system. All files in the volatile memory are lost when the physical device reloads. |
This section contains usage guidelines for the following topics.
Copying Files from a Server to Bootflash Memory
Use the copysource-url bootflash: command (for example, copy tftp:source-urlbootflash:) to copy an image from a server to the local bootflash memory.
Copying a Configuration File from a Server to the Running Configuration
Use the copy {ftp: | scp: | sftp: | tftp:}source-urlrunning-config command to download a configuration file from a network server to the running configuration of the device. The configuration is added to the running configuration as if the commands were typed in the CLI. The resulting configuration file is a combination of the previous running configuration and the downloaded configuration file. The downloaded configuration file has precedence over the previous running configuration.
You can copy either a host configuration file or a network configuration file. Accept the default value of host to copy and load a host configuration file containing commands that apply to one network server in particular. Enter network to copy and load a network configuration file that contains commands that apply to all network servers on a network.
Copying a Configuration File from a Server to the Startup Configuration
Use the copy {ftp: | scp: | sftp: | tftp:}source-urlstartup-config command to copy a configuration file from a network server to the switch startup configuration. These commands replace the startup configuration file with the copied configuration file.
Copying the Running or Startup Configuration on a Server
Use the copy running-config {ftp: | scp: | sftp: | tftp:}destination-url command to copy the current configuration file to a network server that uses FTP, scp, SFTP, or TFTP. Use the copy startup-config {ftp: | scp: | stfp: | tftp:}destination-url command to copy the startup configuration file to a network server.
You can use the copied configuration file copy as a backup.
Examples
This example shows how to copy a file within the same directory:
This example shows how to copy a file to another directory:
This example shows how to copy a file to another file system:
This example shows how to copy a file to another supervisor module:
This example shows how to copy a file from a remote server:
switch# copy scp://192.168.1.1/image-file.bin bootflash:image-file.bin
This example shows how to copy the kickstart and system image to bootflash:
![Server Server](http://social.technet.microsoft.com/wiki/cfs-file.ashx/__key/communityserver-wikis-components-files/00-00-00-00-05/6622.Sftp-architicture.jpg)
switch# copy usb1: bootflash:
Related Commands
Description |
---|
Changes the current working directory. |
Delete a file or directory. |
Displays the directory contents. |
Moves a file. |
Displays the name of the current working directory. |