mc rm

Removes objects from a bucket. Operates on versioned objects in buckets on a local cluster or a remote fabric in the global namespace.

Syntax

CLI
mc rm [FLAGS] TARGET [TARGET ...]

FLAGS:
  --versions                       remove all versions of an object
  --version-id value, --vid value  delete a specific version of an object
  --recursive, -r                  remove recursively
  --force                          allow a recursive remove operation
  --dangerous                      allow site-wide removal of objects
  --fake                           perform a fake remove operation
  --stdin                          read object names from STDIN
  --bypass                         bypass governance
  --json                           enable JSON lines formatted output
  --debug                          enable debug output
  --insecure                       disable SSL certificate verification
  --help, -h                       show help

Parameters

ATTENTION
In Object Store, versioning and delete markers work the same as they do in S3 – If you remove a directory or object from a versioned bucket using the mc rm command, a delete marker is placed against that directory or object while all previous versions of the directory or object are retained. These retained versions occupy space that jobs cannot reclaim when they run against the versioned bucket. If you want jobs to reclaim space, you must use the --versions option to remove all versions of a directory or object when you run the mc rm command, for example:
/opt/mapr/bin/mc rm --recursive --force --versions <alias>/<versionedbucket>/<directory>
Parameter Description
TARGET The alias of a configured HPE Ezmeral Object Store deployment from which the command removes objects. This parameter is mandatory. To remove objects from a remote cluster/fabric in the global namespace use the format <fabricname>-<bucketname>/<objectname> instead of only the <bucketname>/<objectname> after the alias, that is <alias>/<fabricname>-<bucketname>/<objectname>.When the bucketname and objectname is mentioned without the fabric name, Data Fabric checks the local cluster for the specified bucketname and objectname.
versions Removes all versions of an object that exist in the bucket.
recursive Removes objects recursively. When using --recursive, you must also use --force. For versioned buckets, --recursive produces a delete marker for each object removed. If you want to recursively remove all objects and all versions of the objects from the bucket, you must also include the --versions option.
force Force a recursive remove operation.
dangerous Removes all objects from the target.
fake Simulate a remove operation but do not actually remove them.
stdin Read objects from STDIN.
bypass Bypass governance settings and delete the object.
json Enable JSON formatted output.
debug Enable output for debugging.
insecure Disable SSL verification.
help Show this help.

Examples

  1. Remove objects recursively from the bucket songs matching the prefix Jim from the Object Store deployment with alias classmusic:
    CLI
    /opt/mapr/bin/mc rm --recursive --force classmusic/songs/Jim/
  2. Remove all objects from all accounts in the Object Store deployment with alias classmusic:
    CLI
    /opt/mapr/bin/mc rm --recursive --force --dangerous classmusic
  3. Remove object salesspeech.mp4 with governance mode set from the Object Store deployment with alias northamerica:
    CLI
    /opt/mapr/bin/mc rm --bypass northamerica/salesspeech.mp4
  4. Remove object salesspeech.mp4 with version ID f20f3792-4bd4-4288-8d3c-b9d05b3b62f6 set from the Object Store deployment with alias northamerica:
    CLI
    /opt/mapr/bin/mc rm northamerica/salesspeech.mp4 --version-id "f20f3792-4bd4-4288-8d3c-b9d05b3b62f6"
  5. Remove object salesspeech.mp4 with governance mode set in bucket qfoursales of remote cluster sales from the Object Store deployment with alias northamerica:
    CLI
    /opt/mapr/bin/mc rm --bypass northamerica/sales-qfoursales/salesspeech.mp4