Deleting an Object
Function
- You can use this command to delete a specified object.
- You can also use this command to delete objects in batches based on a specified object name prefix.
Command Line Structure
- In Windows
- Deleting a single object
obsutil rm obs://bucket/key [-f] [-versionId=xxx] [-fr] [-o=xxx] [-config=xxx] [-e=xxx] [-i=xxx] [-k=xxx] [-t=xxx]
- Deleting objects in batches
obsutil rm obs://bucket/[key] -r [-j=1] [-f] [-v] [-o=xxx] [-config=xxx] [-e=xxx] [-i=xxx] [-k=xxx] [-t=xxx]
- Deleting a single object
- In Linux or macOS
- Deleting a single object
./obsutil rm obs://bucket/key [-f] [-versionId=xxx] [-fr] [-o=xxx] [-config=xxx] [-e=xxx] [-i=xxx] [-k=xxx] [-t=xxx]
- Deleting objects in batches
./obsutil rm obs://bucket/[key] -r [-j=1] [-f] [-v] [-o=xxx] [-config=xxx] [-e=xxx] [-i=xxx] [-k=xxx] [-t=xxx]
- Deleting a single object
Examples
- Take the Windows OS as an example. Run the obsutil rm obs://bucket-test/key -f command to delete a single object named key in bucket bucket-test.
obsutil rm obs://bucket-test/key -f Delete object [key] in the bucket [bucket-test] successfully!
- Take the Windows OS as an example. Run the obsutil rm obs://bucket-test -r -f command to delete all objects in bucket bucket-test.
obsutil rm obs://bucket-test -r -f [===============================================] 100.00% 21s Succeed count is: 1313 Failed count is: 0 Task id is: 95936984-f81a-441a-bba0-1fd8254d9241
Parameter Description
| Parameter | Optional or Mandatory | Description |
|---|---|---|
| bucket | Mandatory | Bucket name |
| key | Mandatory for deleting a single object. Optional for deleting objects in batches. | Indicates the name of the object to be deleted, or the name prefix of the objects to be deleted in batches. NOTE: If this parameter is left blank when deleting objects in batches, all objects in the bucket are deleted. |
| fr | Optional for deleting a single object (additional parameter) | Generates an operation result list when deleting an object. |
| f | Optional (additional parameter) | Runs in force mode. |
| versionId | Optional for deleting a single object (additional parameter) | Version ID of the object to be deleted. |
| r | Mandatory for deleting objects in batches (additional parameter) | Deletes objects in batches based on a specified object name prefix. |
| j | Optional for deleting objects in batches (additional parameter) | Indicates the maximum number of concurrent tasks for deleting objects in batches. The default value is the value of defaultJobs in the configuration file. NOTE: The value is ensured to be greater than or equal to 1. |
| v | Optional for deleting objects in batches (additional parameter) | Deletes versions of an object and the delete markers in batches based on a specified object name prefix. |
| o | Optional (additional parameter) | Indicates the folder where operation result lists reside. After the command is executed, result lists (possibly including success and failure files) are generated in the folder. The default value is .obsutil_output, the subfolder in the home directory of the user who executes obsutil commands. NOTE:
|
| 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
Refer to Response for uploading an object.
Last Article: Generating the Download Link of an Object
Next Article: Synchronously Uploading Incremental Objects
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.