1
0
mirror of https://github.com/minio/docs.git synced 2025-08-05 03:41:24 +03:00
Files
docs/source/reference/minio-mc/mc-undo.rst
Andrea Longo 3c2258375b Add --action for mc undo (#1133)
Document new option for `mc undo` to restrict the command to reverse
either `DELETE` or `PUT` operations, not both.

Staged

http://192.241.195.202:9000/staging/DOCS-1113/linux/reference/minio-mc/mc-undo.html

Fixes https://github.com/minio/docs/issues/1113
2024-03-22 10:15:22 -06:00

4.0 KiB

mc undo

minio

Table of Contents

mc undo

Syntax

The mc undo command reverses changes due to either a PUT or DELETE operation at a specified path.

EXAMPLE

The following command reverts the last three uploads and/or deletions of the file.zip object on the myminio deployment in the data bucket:

mc undo myminio/data/file.zip --last 3

SYNTAX

The command has the following syntax:

mc [GLOBALFLAGS] undo                \
                 TARGET              \
                 [--action "type"]   \
                 [--force]           \
                 [--last "integer"]  \
                 [--recursive, r]    \
                 [--dry-run]

Parameters

TARGET

The full path to the object or prefix where the command should run. The path must include the ALIAS <minio-mc-alias>, bucket, and prefix or object name.

--action

Undo the most recent change of the specified type. Accepted values are DELETE or PUT.

By default, mc undo reverses both DELETE and PUT operations. Use ~mc undo --action to choose one or the other, but only for the most recent operation of the specified type.

The following command reverts the most recent PUT for the object today.zip in bucket data, reverting to the previous object version:

mc undo myminio/data/today.zip --action "PUT"

This example reverts the most recent DELETE for the prefix archive, recursively restoring it and any child objects:

mc undo myminio/data/archive --recursive --action "DELETE"

Mutually exclusive with ~mc undo --last.

--dry-run

Output the results of the command without actually performing the operations. Use this flag to test the outcome of running the command in a particular way.

--force

Force a recursive operation.

--last

Accepts an integer value specifying the number of PUT and/or DELETE changes to undo.

If not specified, the command reverses one (1) operation. Mutually exclusive with ~mc undo --action.

--recursive, r

Performs the command in a recursive fashion. Use this flag to undo changes on a prefix, for example.

Global Flags

Examples

Undo the Last Three Uploads or Deletions on an Object

The following command reverts the last three uploads and/or deletions of the file.zip object on the myminio deployment in the data bucket:

mc undo myminio/data/file.zip --last 3

Undo the Last Upload or Deletion of any Object at a Prefix

Use mc undo to reverse the most recent PUT or DELETE operation performed on the myminio alias in the data bucket under the presentations/recordings/ prefix:

mc undo myminio/data/presentations/recordings/ --recursive --force

Behavior

S3 Compatibility