Updated on 2023-08-25 GMT+08:00

Querying Object Properties

Function

You can use this command to query the basic properties of an object.

Command Line Structure

  • In Windows
    obsutil stat obs://bucket/key [-acl][-bf=xxx] [-config=xxx] [-e=xxx] [-i=xxx] [-k=xxx] [-t=xxx]
  • In Linux or macOS
    ./obsutil stat obs://bucket/key [-acl][-bf=xxx] [-config=xxx] [-e=xxx] [-i=xxx] [-k=xxx] [-t=xxx]

Examples

  • Take the Windows OS as an example. Run the obsutil stat obs://bucket-test/key command to query the basic properties of an object.
    obsutil stat obs://bucket-test/key
    
    Key:
      obs://bucket-test/key
    LastModified:
      2018-11-16T02:15:49Z
    Size:
      7
    ETag:
      43d93b553855b0e1fc67e31c28c07b65
    ContentType:
      text/plain

Parameter Description

Parameter

Optional or Mandatory

Description

bucket

Mandatory

Bucket name

key

Mandatory

Object name

acl

Optional

Queries the access control policies of the object at the same time.

bf

Optional (additional parameter)

Display format of the object size (in bytes). Possible values are:

  • human-readable
  • raw
NOTE:

If this parameter is not configured, the display format of the object size (in bytes) is determined by the humanReadableFormat parameter in the configuration file.

config

Optional (additional parameter)

User-defined configuration file for executing a command. For details about parameters that can be configured, see Parameter Description.

e

Optional (additional parameter)

Specifies the endpoint.

i

Optional (additional parameter)

Specifies the user's AK.

k

Optional (additional parameter)

Specifies the user's SK.

t

Optional (additional parameter)

Specifies the user's security token.

Response

Field

Description

Key

Object name

LastModified

Latest modification time of the object

Size

Object size, in bytes

StorageClass

Storage class of the object

MD5

Real MD5 of the object

NOTE:

You can query this value only after running the cp command and configuring the -vmd5 parameter.

ETag

ETag value of an object calculated on the server

ContentType

Content-Type of the object

Type

Object type

Metadata

Customized metadata of the object

Acl

Access control policy of the object