unrestore

Updated at:

This topic describes how to run the unrestore command to remove objects restored from the Archived or Cold Archive state. After you run the unrestore command, the restored objects return to the Frozen state.

Considerations

By default, an Alibaba Cloud account has the permissions to remove objects restored from the Archived or Cold Archive state. If you need to perform the removal as a RAM user or by using Security Token Service (STS), you must have the oss:CleanRestoredObject and oss:CleanRestoredObjectVersion permissions. For more information, see Grant custom permissions to a RAM user.

Syntax

ossutil unrestore oss://bucket[/prefix] [flags]

Parameter

Type

Description

--checkers

int

The number of checkers that can run in parallel. Default value: 16.

-d, --dirs

/

Lists objects and subdirectories in the current directory, instead of recursively displaying all objects in all subdirectories.

--encoding-type

string

The encoding method used to encode the object name or file name. Valid value: url.

--end-with

string

Returns objects whose names are lexicographically before the specified value (inclusive).

--exclude

stringArray

The exclusion rule for paths or file names.

--exclude-from

stringArray

Reads exclusion rules from a file.

--files-from

stringArray

Reads a list of source object names from a file, with empty lines and comment lines ignored.

--files-from-raw

stringArray

Reads a list of source objects from a file.

--filter

stringArray

The filter rule for paths or object names.

--filter-from

stringArray

Reads filter rules from a file.

-f, --force

/

Specifies that the operation is forcibly performed without a prompt for confirmation.

--include

stringArray

The inclusion rule for paths or object names.

--include-from

stringArray

Reads inclusion rules from a file.

-j, --job

int

The number of tasks that can concurrently run among multiple objects. Default value: 3.

--limited-num

int

The maximum number of results to return.

--list-format

string

The format of objects in the list file. Valid values: plain and inventory.

--list-manifest-from

string

Specifies that the descriptions of objects in the list file are read. This parameter is required only if the --list-format parameter is set to inventory.

--list-objects

/

Lists objects by calling the ListObjects operation.

--max-size

SizeSuffix

The maximum size of a file or object that can be transferred. By default, the size is in bytes (B). You can suffix the numerical value with a 1024-based unit: B for byte, K for Kibibyte, M for Mebibyte, G for Gibibyte, T for Tebibyte, or P for Pebibyte.

--metadata-exclude

stringArray

The exclusion rules for object metadata.

--metadata-filter

stringArray

The filtering rule for object metadata.

--metadata-filter-from

stringArray

Reads the metadata filter rule from a file.

--metadata-include

stringArray

The inclusion rules for object metadata.

--min-age

Duration

Applies the unrestore operation only to objects that were modified before the specified time interval. The default unit is seconds. You can use a unit suffix. For example, 1h indicates one hour.

Note

--min-age 1h indicates that the unrestore operation applies only to objects that were modified one hour ago or earlier.

--max-age

Duration

Applies the unrestore operation only to objects that were modified within the specified time interval. The default unit is seconds. You can use a unit suffix. For example, 1h indicates one hour.

Note

--max-age 1h indicates that the unrestore operation applies only to objects that were modified within the last hour.

--min-mtime

Time

Applies the unrestore operation only to objects that were modified after the specified time. The time format is UTC. Example: 2006-01-02T15:04:05.

Note

--min-mtime "2006-01-02T15:04:05" indicates that the unrestore operation applies only to objects that were modified after January 2, 2006, 15:04:05.

--max-mtime

Time

Applies the unrestore operation only to objects that were modified before the specified time. The time format is UTC. Example: 2006-01-02T15:04:05.

--min-size

SizeSuffix

The minimum size of a file or object that can be transferred. By default, the size is in bytes (B). You can suffix the numerical value with a 1024-based unit: B for byte, K for Kibibyte, M for Mebibyte, G for Gibibyte, T for Tebibyte, or P for Pebibyte.

--no-check-status

/

Specifies that the object status is not checked before removal. This parameter takes effect only in list mode.

--no-error-report

/

Specifies that no error report objects are generated when you run the unrestore command to remove multiple objects.

--no-progress

/

Does not display the progress bar.

--page-size

int

The maximum number of objects to list on each page during batch processing. Default value: 1000. Valid values: 1 to 1000.

--output-dir

string

The directory in which the output objects are stored. Output objects include the report objects generated when you run the unrestore command to remove multiple objects. Default value: ossutil_output.

-r, --recursive

/

Specifies recursion. If this option is specified, the command performs the operation on all matching objects in the bucket. If this option is not specified, the command performs the operation only on the specified object.

--request-payer

string

The payer of the request. If pay-by-requester is enabled, specify this parameter. Valid value: requester.

--start-after

string

Specifies that objects whose names are alphabetically after the value of the --start-after parameter are returned.

--version-id

string

The version ID of the object.

Note

For more information, see Supported global command-line options.

Examples

  • The following example shows how to remove an object named example.txt that is restored from the Archived or Cold Archive state in the examplebucket bucket:

    ossutil unrestore oss://examplebucket/example.txt
  • The following example shows how to remove all objects that are restored from the Archived or Cold Archive state in the dir directory of the examplebucket bucket:

    ossutil unrestore oss://examplebucket/dir -r
  • The following example shows how to remove an object named example.txt with the version ID 123 that is restored from the Archived or Cold Archive state in the examplebucket bucket:

    ossutil unrestore oss://examplebucket/example.txt --version-id 123
  • The following example shows how to remove the first 100 objects that are restored from the Archived or Cold Archive state in the dir directory of the examplebucket bucket:

    ossutil unrestore oss://examplebucket/dir --limited-num 100 -r
  • The following example shows how to remove objects that are restored from the Archived or Cold Archive state and created within the last three days in the dir1 and dir2 subdirectories of the rootdir directory in the examplebucket bucket:

    ossutil unrestore oss://examplebucket/rootdir/rootdir --include "/dir1/**" --include "/dir2/**" --max-age 3d -r
  • The following example shows how to remove objects that are restored from the Archived or Cold Archive state based on a list of objects in a file:

    Note

    In a list file, each line represents an object in the oss://{bucket}/{key} format. The following sample code provides examples of list.txt objects:

    oss://examplebucket/key1
    oss://examplebucket/key2
    ossutil unrestore list://local-list.txt
  • The following example shows how to directly remove objects that are restored from the Archived or Cold Archive state from a list without checking the object status:

    ossutil unrestore list://local-list.txt --no-check-status
  • The following example shows how to remove objects that are restored from the Archived or Cold Archive state from an inventory list:

    Note

    After an inventory task is executed, two files named csv.gz and manifest.json are generated. When you restore objects from the inventory list, both files are required.

    ossutil unrestore list://ca8007fc-4123-493e-9a01-dd1511fb****.csv.gz --list-format inventory --list-manifest-from manifest.json