You can run the set-props command to configure object attributes, such as the object access control list (ACL), storage class, metadata, and tags.
Command syntax
ossutil set-props oss://bucket[/prefix] [flags]
Parameter | Type | Description |
--acl | string | The ACL of the object. Valid values:
|
--bigfile-threshold | int | The object size threshold for multipart upload, download, and copy. Default value: 104857600. |
--cache-control | string | The caching behavior of the web page when the object is downloaded. |
--content-disposition | string | The display form of the object. |
--content-encoding | string | The encoding method used to encode the object. |
--content-type | string | The content type of the object. |
-d, --dirs | / | Specifies that the objects and subdirectories in the current directory are returned. |
--encoding-type | string | The encoding method used to encode the object name. Valid value: url. |
--end-with | string | Specifies that objects whose names are alphabetically before or the same as the value of the --end-with parameter are returned. |
--exclude | stringArray | The exclusion rule for the path or object name. |
--exclude-from | stringArray | Specifies that the exclusion rule is read from the rules file. |
--expires | string | The absolute expiration time of the cached content. |
--files-from | stringArray | Specifies that the source object names are read from the rules file, and empty lines or comment lines are ignored. |
--files-from-raw | stringArray | Specifies that the source object names are read from the rules file. |
--filter | stringArray | The filter rule for the path or object name. |
--filter-from | stringArray | Specifies that the filter rule for the path or object name is read from the rules file. |
-f, --force | / | Specifies that the command is forcibly run without a prompt for confirmation. |
--include | stringArray | The inclusion rule for the path or object name. |
--include-from | stringArray | Specifies that the inclusion rule is read from the rules file. |
-j, --job | int | The number of concurrent tasks that can be performed on multiple objects. Default value: 3. |
--list-objects | / | Specifies that the ListObjects operation is called to list objects. |
--max-age | Duration | Specifies that the objects whose last modified time is earlier than the value of the --max-age parameter are not transferred. The default unit is seconds. The unit can be milliseconds, seconds, minutes, hours, days, weeks, months, or years. By default, this parameter is left empty. |
--max-mtime | Time | Specifies that the objects whose last modified time is later than the value of the --max-mtime parameter are not transferred. The value is in UTC. By default, this parameter is left empty. |
--max-size | SizeSuffix | The maximum size of the object that can be transferred. The default unit is bytes. The unit of object size can be bytes, KiB, MiB, GiB, TiB, or PiB. Note: 1 KiB = 1,024 bytes. |
--metadata | strings | The user metadata of the object in the key=value format. Example: --metadata test=value,test1=value1. |
--metadata-directive | string | The parameter used to modify the object metadata. Valid values:
|
--metadata-exclude | stringArray | The exclusion rule for object metadata. |
--metadata-filter | stringArray | The filter rule for object metadata. |
--metadata-filter-from | stringArray | Specifies that the filter rule for object metadata is read from the rules file. |
--metadata-include | stringArray | The inclusion rule for object metadata. |
--min-age | Duration | Specifies that the objects whose last modified time is later than the value of the --min-age parameter are not transferred. The default unit is seconds. The unit can be milliseconds, seconds, minutes, hours, days, weeks, months, or years. By default, this parameter is left empty. |
--min-mtime | Time | Specifies that the objects whose last modified time is earlier than the value of the --min-mtime parameter are not transferred. The value is in UTC. By default, this parameter is left empty. |
--min-size | SizeSuffix | The minimum size of the object that can be transferred. The default unit is bytes. The unit of object size can be bytes, KiB, MiB, GiB, TiB, or PiB. Note: 1 KiB = 1,024 bytes. |
--no-progress | / | Specifies that the progress bar is not displayed. |
--page-size | int | The maximum number of objects that can be returned. Default value: 1000. Valid values: 1 to 1000. |
--parallel | int | The number of concurrent tasks for internal operations on a single object. |
--part-size | SizeSuffix | The part size. By default, ossutil calculates the appropriate part size based on the object size. Valid values: 100 KiB to 5 GiB. |
-r, --recursive | / | Specifies that the command is recursively run on objects. If this parameter is specified, the set-props command takes effect on all objects that meet the conditions in the bucket. Otherwise, the set-props command takes effect only on the objects in the specified path. |
--request-payer | string | The payer of the request. If pay-by-requester is enabled for the bucket, set this parameter to requester. |
--start-after | string | Specifies that objects whose names are alphabetically after the value of the --start-after parameter are returned. |
--storage-class | string | The storage class of the object. Valid values:
|
--tagging | strings | The tags of the object in the key=value format. Example: --tagging tag1=value1,tag2=value2. |
--tagging-directive | string | The parameter used to modify the object tags. Valid values:
|
--version-id | string | The version ID of the object. |
--list-format | string | The format of the list file. Valid values: plain and inventory. |
--list-manifest-from | string | Read the format description of the list file from the file. You are required to specify this parameter if the format is inventory. |
For more information, see Command-line options.
Examples
Set the ACL of the exampleobject.txt object to private:
ossutil set-props oss://examplebucket/exampleobject.txt --acl private
Set the storage class of the exampleobject.txt object to Archive:
ossutil set-props oss://examplebucket/exampleobject.txt --storage-class Archive
Set the content-type parameter of objects whose names contain the .txt suffix to text/plain:
ossutil set-props oss://bucket/prefix --content-type text/plain --include *.txt --metadata-directive update -r
Configure tags for the exampleobject.txt object:
ossutil set-props oss://examplebucket/exampleobject.txt --tagging tag1=value1 --tagging-directive update
Set object attributes from the list.
NoteEach line in the list file represents an object. All objects within are in the format of the OSS path: oss://{bucket}/{key}.
The following section uses list.txt as an example.
oss://examplebucket/key1 oss://examplebucket/key2
ossutil set-props list://list.txt
Set object attributes from the list file.
NoteA csv.gz file and a manifest.json file are generated after the inventory is configured, which are required for the configuration of objects.
ossutil set-props list://ca8007fc-4123-493e-9a01-dd1511fbac54.csv.gz --list-format inventory --list-manifest-from manifest.json