copy

Prev Next

Available in Classic and VPC

Copy an object to a new location. If you do not specify a destination, only the object's metadata is changed.

Syntax

The copy syntax is as follows:

swift copy \
    <container> \
    <object> \
    [--destination <destination-path>] \
    [--fresh-metadata] \
    [--meta <name:value>] \
    [--header <header:value>]

Options

This section describes the options available when running copy.

Required options

The following options are required for copy.

Options Type Required Description
<container> String Required Container name
<object> List Required Object name
  • Multiple entries are allowed, separated by spaces.

Optional options

These are the optional options for copy. Options that are not specified will use their default values.

Options Type Required Description
--destination String Optional Container and object names to copy
  • Enter in /container/object format.
  • If the object name is omitted, the same name as the source is used.
  • An error occurs if you specify object names when copying multiple objects.
--fresh-metadata Boolean Optional Copy excluding existing metadata.
  • If left blank, existing metadata is retained or appended.
--meta String Optional Metadata entry
  • Enter in name:value format.
--header String Optional Custom header to use in the request
  • Enter in header:value format.

Common options

For information about the options common to all swift subcommands, see Archive Storage options.

Examples

When you run the command, the source object and destination path are displayed.

Command

The command example is as follows:

swift copy test-container-01 sample.txt \
    --destination /test-container-01/copied.txt

Output

The output example is as follows:

created container test-container-01
test-container-01/sample.txt copied to /test-container-01/copied.txt