Listing Object Keys
Last updated: 2019-11-22 14:46:19PDF
Tencent Cloud COS supports listing keys by prefix. You can use the separator (
/) in a key to implement a hierarchical structure similar to the traditional file system. In COS, you can use separators to select and browse keys hierarchically.
You can list all keys in a single bucket in UTF-8 binary order of prefixes or filter the key list by specifying the prefix. For example, adding the parameter
t, would list the
tencent object, while skipping objects prefixed with
a or other characters.
Keys can be reorganized based on the added separator (
/). You can use the prefix and separator together to implement a folder retrieval feature. For example, if you add the prefix parameter
t and the separator (
/), eligible keys such as
tencent/cos will be listed.
COS supports storing an unlimited number of objects in a single bucket, so the key list may be very large. For management purposes, a maximum of 1,000 key values are returned for one List Objects request, and a marker will be returned to indicate whether the result is truncated. You can send a series of List Objects requests based on markers and separators to list all key values or search for the desired content.
Via REST API
You can use the REST API directly to initiate an object key listing request. For more information, see GET Bucket.
Via the SDK
You can directly call the object list querying method in the SDK. For more information, see the SDK documentation for the corresponding programming language below: