Documentation

Documentation

mc undo

Syntax

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

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

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

The command has the following syntax:

mc [GLOBALFLAGS] undo               \
                 TARGET             \
                 [--last "integer"] \
                 [--recursive, r]   \
                 [--force]          \
                 [--dry-run]
  • Brackets [] indicate optional parameters.

  • Parameters sharing a line are mutually dependent.

  • Parameters separated using the pipe | operator are mutually exclusive.

Copy the example to a text editor and modify as-needed before running the command in the terminal/shell.

Parameters

TARGET
Required

The full path to the object or prefix where the command should run. The path must include the ALIAS, bucket, and prefix or object name.

--last
Optional

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

If not specified, the command undoes one (1) operation.

--recursive, r
Optional

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

--force
Optional

Force a recursive operation.

--dry-run
Optional

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.

Global Flags

This command supports any of the global flags.

Examples

Undo the Last Three Uploads or Deletions on an Object

The following command undoes the last three uploads and/or removals 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

The mc commandline tool is built for compatibility with the AWS S3 API and is tested with MinIO and AWS S3 for expected functionality and behavior.

MinIO provides no guarantees for other S3-compatible services, as their S3 API implementation is unknown and therefore unsupported. While mc commands may work as documented, any such usage is at your own risk.

Join Slack 商业支持购买咨询