mc cp

Copies objects to and from buckets.

Syntax

CLI
mc cp [FLAGS] SOURCE [SOURCE...] TARGET

FLAGS:
  --version-id value, --vid value    select an object version to copy
  --recursive, -r                    copy recursively
  --attr value                       add custom metadata for the object
  --preserve, -a                     preserve filesystem attributes (mode, ownership, timestamps)
  --disable-multipart                disable multipart upload feature
  --md5                              force all upload(s) to calculate md5sum checksum
  --retention-mode value             retention mode to be applied on the object (governance, compliance)
  --retention-duration value         retention duration for the object in d days or y years
  --legal-hold value                 apply legal hold to the copied object (on, off)
  --tags value                       add tags for the object
  --json                             enable JSON lines formatted output
  --debug                            enable debug output
  --insecure                         disable SSL certificate verification
  --help, -h                         show help

Parameters

Parameter Description
SOURCE The source from which an object is copied. This can be the filesystem or the alias of a configured HPE Ezmeral Object Store deployment. This parameter is mandatory.
TARGET The destination to which an object is copied. This can be the filesystem or the alias of a configured HPE Ezmeral Object Store deployment. This parameter is mandatory.
version-id The object version to copy.
recursive Copy objects recursively and not just the top-level folder.
attr Add custom metadata for the object.
preserve Preserve filesystem attributes such as mode, timestamps and ownership when copying.
disable-multipart Disable the multipart upload feature.
md5 Calculate the md5 checksum when uploading.
retention-mode The retention mode - either governance or compliance - to apply to the object.
retention-duration Set the duration of the retention mode in days (d) or years (y).
legal-hold Set legal hold for the object.
tags Add tags for the object.
json Enable JSON formatted output.
debug Enable output for debugging.
insecure Disable SSL verification.
help Show this help.

Examples

  1. Copy local folders fin1 and fin2 recursively to a bucket named northamerica in the Object Store deployment with alias salesobject:
    CLI
    /opt/mapr/bin/mc cp --recursive fin1/ fin2/ salesobject/northamerica/
  2. Copy a list of Excel files (.xls) with specified metadata, separated by ";" from the profit folder to a bucket named northamerica in the Object Store deployment with alias salesobject
    CLI
    /opt/mapr/bin/mc cp --attr "key1=value1;key2=value2" profit/*.xls salesobject/northamerica/
  3. Copy the file secret.txt with object lock mode set to governance with retention duration 1 day, from the profit folder to a bucket named northamerica in the Object Store deployment with alias salesobject:
    CLI
    /opt/mapr/bin/mc cp --retention-mode governance --retention-duration 1d profit/secret.txt salesobject/northamerica/
  4. Copy the file secret.txt with legal hold enabled, from the profit folder to a bucket named northamerica in the Object Store deployment with alias salesobject:
    CLI
    /opt/mapr/bin/mc cp --legal-hold on profit/secret.txt salesobject/northamerica/