copy

This command copies a file to or from the DataPower® file system.

Syntax

copy [-f] source destination [manager]

Parameters

-f
Overwrites an existing file when one with the same name exists. When omitted, an attempt to save a file with the same name as an existing file results in a confirmation prompt.
source
destination
Specifies the locations as a URL that identifies the source file and target destination.
  • When the source or destination is the DataPower Gateway, use the directory:///file format.
  • If the source file or target destination is remote and the transport protocol is SCP or SFTP, use a format that is RFC 1738 compliant.
    To use an absolute path.
    scp://user@host:port//file_path
    sftp://user@host:port//file_path
    To use a path that is relative to the user's home directory.
    scp://user@host:port/file_path
    sftp://user@host:port/file_path
    Where
    host
    Specifies the fully qualified hostname or IP address of the remote server. If DNS is enabled, the hostname.
    port
    Specifies the listening port on the remote server.

    After you enter the command, you are prompted for the remote login password.

manager
Specifies the name of an XML manager that defines the user agent for basic authentication. When omitted, basic authentication settings for the default XML manager are used.

Guidelines

The copy command transfers files to or from the DataPower file system. You must issue this command from the DataPower Gateway.

  • The -f parameter forces an unconditional copy. When provided, the command does not warn of possible file overwrites.
  • The manager parameter defines the basic authentication configuration to use. When provided, the command uses the user agent for this XML manager instead of the default XML manager.
When the source file or target destination is remote to the DataPower Gateway, this command supports only the following protocols.
  • HTTP
  • HTTPS
  • Secure Copy (SCP)
  • Secured File Transfer Protocol (SFTP)
Note: If you use SCP or SFTP to copy multiple files at the same time, a system error might occur. The DataPower Gateway supports only one SCP or SFTP connection at a time. Issue the command again if you encounter a system error.

To send a file as an email, use the Global send file command.

Restriction: When you use the copy command, be aware of the following restrictions.
  • You cannot copy files from the cert: directory.
  • You cannot copy files to the audit:, logstore:, or logtemp: directory.

Examples

  • Use HTTP to copy a file from the specified location to the image: directory.
    # copy http://host/image.crypt image:///image.crypt
    File copy success (1534897 bytes transferred)
  • Use HTTPS to copy a file from the specified location to the image: directory.
    # copy https://host/image.crypt image:///image.crypt
    File copy success (1534897 bytes transferred)
  • Use HTTP to copy a file from the specified location to the local: directory with the basic authentication credentials in the sec XML manager.
    # copy http://host/sec/stock.wsdl local:///stock.wsdl sec
    File copy success (2022 bytes copied)
  • Use SCP to copy a file from the specified location to the store: directory.
    # copy scp://jrb@10.10.1.159//XML/stylesheets/InitialConvert.xsl 
    store:///InitialConvert.xsl
         Password: yetanotherpassword
    File copy success
  • Use SCP to copy a file from the logstore: directory to the specified remote target (identified by a qualified hostname).
    # copy logstore:///Week1.log scp://jrb@ragnarok.datapower.com//LOGS/Week1.log
         Password: yetanotherpassword
    File copy success
  • Use SFTP to copy a file from the specified location to the store: directory.
    # copy sftp://jrb@10.10.1.159//XML/stylesheets/InitalConvert.xsl
     store:///InitalConvert.xsl
         Password: yetanotherpassword
    File copy success
  • Use SFTP to copy a file from the logstore: directory to the specified remote target.
    # copy logstore:///Week1.log sftp://jrb@10.10.1.159//LOGS/x/Week1.log
         Password: yetanotherpassword
    File copy success
  • Copy the startup-config file from the config: directory to the local: directory.
    # copy config:///startup-config local:///startup-config
    file copy successful (2347 bytes transferred)