All Products
Search
Document Center

Object Storage Service:delete-object

Last Updated:Sep 25, 2024

The delete-object command is used to delete objects in OSS buckets.

Usage notes

  • By default, an Alibaba Cloud account has the permissions to delete files. Deleting files as a RAM user or by using Security Token Service (STS) requires oss:DeleteObject permission. For more information, see Attach a custom policy to a RAM user.

  • If the object you want to delete is a symbolic link, the DeleteObject operation deletes only the symbolic link but not the content to which the link points.

Command syntax

ossutil api delete-object --bucket value --key value [flags]

Parameter

Type

Description

--bucket

string

Name of the bucket.

--key

string

Full path of the object.

--version-id

string

Version ID of the object.

Note
  • The delete-object command corresponds to the DeleteObject operation. For more information about the parameters in the DeleteObject operation, see DeleteObject.

  • For more information about supported global command-line options, see Command-line options.

Examples

  • Delete the exampleobject object.

    ossutil api delete-object --bucket examplebucket --key exampleobject
  • Delete the exampleobject object whose version ID is 123.

    ossutil api delete-object --bucket examplebucket --key exampleobject --version-id 123