Files
doc-exports/docs/obs/tool-obsutil/obs_11_0014.html
weihongmin1 a41a4e0331 OBS Util 0115 Version
Reviewed-by: Sabelnikov, Dmitriy <dmitriy.sabelnikov@t-systems.com>
Co-authored-by: weihongmin1 <weihongmin1@huawei.com>
Co-committed-by: weihongmin1 <weihongmin1@huawei.com>
2026-02-17 10:18:57 +00:00

247 lines
21 KiB
HTML

<a name="obs_11_0014"></a><a name="obs_11_0014"></a>
<h1 class="topictitle1">Listing Objects</h1>
<div id="body1542943180896"><div class="section" id="obs_11_0014__section1479112110815"><h4 class="sectiontitle">Function</h4><p id="obs_11_0014__p178478162456">You can use this command to query objects or object versions in a bucket. All objects are listed in lexicographical order by object name and version ID.</p>
</div>
<div class="section" id="obs_11_0014__section1220752192216"><h4 class="sectiontitle">Command Line Structure</h4><ul id="obs_11_0014__ul17832169163716"><li id="obs_11_0014__li383219919376">In Windows<pre class="screen" id="obs_11_0014__screen461020247370">obsutil ls obs://bucket[/prefix] [-s] [-d][-fs] [-v] [-du] [-marker=xxx] [-versionIdMarker=xxx] [-bf=xxx] [-limit=1] [-config=xxx] </pre>
</li><li id="obs_11_0014__li126121614103718">In Linux or macOS<pre class="screen" id="obs_11_0014__screen13336143183713">./obsutil ls obs://bucket[/prefix] [-s][-fs] [-d] [-v] [-du] [-marker=xxx] [-versionIdMarker=xxx] [-bf=xxx] [-limit=1] [-config=xxx] </pre>
</li></ul>
</div>
<div class="section" id="obs_11_0014__section0398183023616"><h4 class="sectiontitle">Examples</h4><ul id="obs_11_0014__ul8399163013612"><li id="obs_11_0014__li639953014362">Example 1: Take the Windows OS as an example. Run the <strong id="obs_11_0014__b1749332852013">obsutil ls obs://bucket-test -limit=10</strong> command to list objects in the bucket.<pre class="screen" id="obs_11_0014__screen8399430143612"><strong id="obs_11_0014__b163995307365">obsutil ls obs://bucket-test -limit=10</strong>
Start at 2024-09-30 08:18:50.0592788 +0000 UTC
Listing objects .
Folder list:
obs://bucket-test/api/
Object list:
key LastModified Size StorageClass ETag
obs://bucket-test/AUTHORS 2018-11-16T02:15:49Z 33243 standard "796393c1eaf502ef56a85c2ceb640aea"
obs://bucket-test/CONTRIBUTING.md 2018-11-16T02:15:49Z 1366 standard "12d93325ba6131f852daecd18dd65edc"
obs://bucket-test/CONTRIBUTORS 2018-11-16T02:15:49Z 45710 standard "b486b5003e6215c9199e86ab3ccec9fa"
obs://bucket-test/LICENSE 2018-11-16T02:15:49Z 1479 standard "5d4950ecb7b26d2c5e4e7b4e0dd74707"
obs://bucket-test/PATENTS 2018-11-16T02:15:49Z 1303 standard "3a55d95595a6f9e37dee53826b4daff2"
obs://bucket-test/README.md 2018-11-16T02:15:49Z 1399 standard "97351fd7946b9ea021a31a86ba2a10ab"
obs://bucket-test/VERSION 2018-11-16T02:15:49Z 7 standard "43d93b553855b0e1fc67e31c28c07b65"
obs://bucket-test/api/README 2018-11-16T02:15:49Z 521 standard "4e9e63a87075df60cdf65c8ce9e92117"
obs://bucket-test/api/except.txt 2018-11-16T02:15:49Z 20194 standard "8eb96de3f60447e2f09a7531c99fb3ee"
Next marker: api/except.txt
Folder number: 1
File number: 9</pre>
</li></ul>
<ul id="obs_11_0014__ul240233011365"><li id="obs_11_0014__li3771142851512">Example 2: Take the Windows OS as an example. Run the <strong id="obs_11_0014__b63981935113015">obsutil ls obs://bucket-test2</strong> command to list objects in the bucket.<pre class="screen" id="obs_11_0014__screen11137105216153"><strong id="obs_11_0014__b10422051151910">obsutil ls obs://bucket-test2</strong>
Start at 2024-09-30 08:21:06.6300221 +0000 UTC
Listing objects .
Object list:
key LastModified Size StorageClass ETag
obs://bucket-test2/123 2022-03-29T09:17:51Z 0B standard "d41d8cd98f00b204e9800998ecf8427e"
obs://bucket-test2/1_2-3.txt 2022-03-29T09:17:51Z 0B standard "d41d8cd98f00b204e9800998ecf8427e"
obs://bucket-test2/1_2-3_33.txt 2022-03-29T09:17:51Z 200B standard "dcf204c11d791255adc63e61763c2426"
obs://bucket-test2/<em id="obs_11_0014__i165161583210">New text file</em>.txt
2022-03-29T09:17:51Z 0B standard "d41d8cd98f00b204e9800998ecf8427e"
Total size of bucket: 200B
Folder number: 0
File number: 4</pre>
</li><li id="obs_11_0014__li147065182011">Example 3: Take the Windows OS as an example. Run the <strong id="obs_11_0014__b18937345945">obsutil ls obs://bucket-test2/prefix</strong> command to list objects whose name prefix is <strong id="obs_11_0014__b1831620531512">prefix</strong> in the bucket.<pre class="screen" id="obs_11_0014__screen63047194215"><strong id="obs_11_0014__b33041419162117">obsutil ls obs://bucket-test2/prefix</strong>
Start at 2024-09-30 08:24:36.7057148 +0000 UTC
Listing objects .
Object list:
key LastModified Size StorageClass ETag
obs://bucket-test2/prefix 2022-03-29T09:17:51Z 0B standard "d41d8cd98f00b204e9800998ecf8427e"
obs://bucket-test2/prefix2 2022-03-29T09:17:51Z 0B standard "d41d8cd98f00b204e9800998ecf8427e"
Total size of prefix [prefix]:: 0B
Folder number: 0
File number: 2</pre>
</li><li id="obs_11_0014__li144021230173611">For more examples, see <a href="obs_11_0027.html">Common Examples</a>.</li></ul>
</div>
<div class="section" id="obs_11_0014__section6559191102418"><h4 class="sectiontitle">Parameter Description</h4>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="obs_11_0014__table10831182114445" frame="border" border="1" rules="all"><thead align="left"><tr id="obs_11_0014__row683212154419"><th align="left" class="cellrowborder" valign="top" width="18.19%" id="mcps1.3.4.2.1.4.1.1"><p id="obs_11_0014__p118329219446">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="26.16%" id="mcps1.3.4.2.1.4.1.2"><p id="obs_11_0014__p15137125919108">Optional or Mandatory</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="55.65%" id="mcps1.3.4.2.1.4.1.3"><p id="obs_11_0014__p12832121184414">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="obs_11_0014__row108328217449"><td class="cellrowborder" valign="top" width="18.19%" headers="mcps1.3.4.2.1.4.1.1 "><p id="obs_11_0014__p64495172515">bucket</p>
</td>
<td class="cellrowborder" valign="top" width="26.16%" headers="mcps1.3.4.2.1.4.1.2 "><p id="obs_11_0014__p154316502519">Mandatory</p>
</td>
<td class="cellrowborder" valign="top" width="55.65%" headers="mcps1.3.4.2.1.4.1.3 "><p id="obs_11_0014__p17425512259">The bucket name</p>
</td>
</tr>
<tr id="obs_11_0014__row77261271514"><td class="cellrowborder" valign="top" width="18.19%" headers="mcps1.3.4.2.1.4.1.1 "><p id="obs_11_0014__p157268710117">prefix</p>
</td>
<td class="cellrowborder" valign="top" width="26.16%" headers="mcps1.3.4.2.1.4.1.2 "><p id="obs_11_0014__p19727157912">Optional</p>
</td>
<td class="cellrowborder" valign="top" width="55.65%" headers="mcps1.3.4.2.1.4.1.3 "><p id="obs_11_0014__p177272717115">The prefix of the object name for listing objects</p>
<div class="note" id="obs_11_0014__note129881917144317"><span class="notetitle"> NOTE: </span><div class="notebody"><p id="obs_11_0014__p2479161820431">If this parameter is left blank, all objects in the bucket are listed.</p>
</div></div>
</td>
</tr>
<tr id="obs_11_0014__row167881281811"><td class="cellrowborder" valign="top" width="18.19%" headers="mcps1.3.4.2.1.4.1.1 "><p id="obs_11_0014__p37889281012">s</p>
</td>
<td class="cellrowborder" valign="top" width="26.16%" headers="mcps1.3.4.2.1.4.1.2 "><p id="obs_11_0014__p177888281316">Optional (additional parameter)</p>
</td>
<td class="cellrowborder" valign="top" width="55.65%" headers="mcps1.3.4.2.1.4.1.3 "><p id="obs_11_0014__p1378816281111">Displays simplified query result.</p>
<div class="note" id="obs_11_0014__note1452085114212"><span class="notetitle"> NOTE: </span><div class="notebody"><p id="obs_11_0014__p252035122111">In the simplified format, the returned result contains only the object name.</p>
</div></div>
</td>
</tr>
<tr id="obs_11_0014__row105292037563"><td class="cellrowborder" valign="top" width="18.19%" headers="mcps1.3.4.2.1.4.1.1 "><p id="obs_11_0014__p145294376611">d</p>
</td>
<td class="cellrowborder" valign="top" width="26.16%" headers="mcps1.3.4.2.1.4.1.2 "><p id="obs_11_0014__p18226142117716">Optional (additional parameter)</p>
</td>
<td class="cellrowborder" valign="top" width="55.65%" headers="mcps1.3.4.2.1.4.1.3 "><p id="obs_11_0014__p853014371767">Lists only objects and subdirectories in the current directory, instead of recursively listing all objects and subdirectories.</p>
<p id="obs_11_0014__p133922034203">In big data scenarios, parallel file systems usually have deep directory levels and each directory has a large number of files. In such case, you are advised to use this parameter to limit the scope to list.</p>
<div class="note" id="obs_11_0014__note1255192611160"><span class="notetitle"> NOTE: </span><div class="notebody"><p id="obs_11_0014__p156102661616">According to the naming conventions in OBS, a slash (/) is used as the directory separator.</p>
</div></div>
</td>
</tr>
<tr id="obs_11_0014__row68204468610"><td class="cellrowborder" valign="top" width="18.19%" headers="mcps1.3.4.2.1.4.1.1 "><p id="obs_11_0014__p3820124620619">v</p>
</td>
<td class="cellrowborder" valign="top" width="26.16%" headers="mcps1.3.4.2.1.4.1.2 "><p id="obs_11_0014__p982013461162">Optional (additional parameter)</p>
</td>
<td class="cellrowborder" valign="top" width="55.65%" headers="mcps1.3.4.2.1.4.1.3 "><p id="obs_11_0014__p108200466610">Lists versions of an object in a bucket. The result contains the latest version and historical versions (if any) of the object.</p>
</td>
</tr>
<tr id="obs_11_0014__row182013491164"><td class="cellrowborder" valign="top" width="18.19%" headers="mcps1.3.4.2.1.4.1.1 "><p id="obs_11_0014__p1201174920618">marker</p>
</td>
<td class="cellrowborder" valign="top" width="26.16%" headers="mcps1.3.4.2.1.4.1.2 "><p id="obs_11_0014__p1020113491669">Optional (additional parameter)</p>
</td>
<td class="cellrowborder" valign="top" width="55.65%" headers="mcps1.3.4.2.1.4.1.3 "><p id="obs_11_0014__p820104913610">The start position for listing objects in a bucket. The objects following this start position are sorted in lexicographical order by object name.</p>
<div class="note" id="obs_11_0014__note14528254193716"><span class="notetitle"> NOTE: </span><div class="notebody"><p id="obs_11_0014__p252885413370">For details about how to use this parameter, see <a href="obs_11_0031.html">Listing</a>.</p>
</div></div>
</td>
</tr>
<tr id="obs_11_0014__row1558665118612"><td class="cellrowborder" valign="top" width="18.19%" headers="mcps1.3.4.2.1.4.1.1 "><p id="obs_11_0014__p858665116612">versionIdMarker</p>
</td>
<td class="cellrowborder" valign="top" width="26.16%" headers="mcps1.3.4.2.1.4.1.2 "><p id="obs_11_0014__p16675153711112">Optional (additional parameter). It must be used together with the <strong id="obs_11_0014__b18703701119">v</strong> and <strong id="obs_11_0014__b9569143121112">marker</strong> parameters.</p>
</td>
<td class="cellrowborder" valign="top" width="55.65%" headers="mcps1.3.4.2.1.4.1.3 "><p id="obs_11_0014__p95866511617">The start position for listing object versions in a bucket. The object versions following this start position are sorted in lexicographical order by object name.</p>
<div class="note" id="obs_11_0014__note183041831558"><span class="notetitle"> NOTE: </span><div class="notebody"><p id="obs_11_0014__p93043312514">If the value of <strong id="obs_11_0014__b842352706143726">versionIdMarker</strong> is not a version ID specified by <strong id="obs_11_0014__b842352706143743">marker</strong>, <strong id="obs_11_0014__b1781920833143750">versionIdMarker</strong> is invalid.</p>
</div></div>
</td>
</tr>
<tr id="obs_11_0014__row193001710154315"><td class="cellrowborder" valign="top" width="18.19%" headers="mcps1.3.4.2.1.4.1.1 "><p id="obs_11_0014__p63016107437">bf</p>
</td>
<td class="cellrowborder" valign="top" width="26.16%" headers="mcps1.3.4.2.1.4.1.2 "><p id="obs_11_0014__p10301510184317">Optional (additional parameter)</p>
</td>
<td class="cellrowborder" valign="top" width="55.65%" headers="mcps1.3.4.2.1.4.1.3 "><p id="obs_11_0014__p1930171012438">The display formats of bytes in the listing result. Possible values are:</p>
<ul id="obs_11_0014__ul1273864144412"><li id="obs_11_0014__li17738649445">human-readable</li><li id="obs_11_0014__li1551213137447">raw</li></ul>
<div class="note" id="obs_11_0014__note11602143394810"><span class="notetitle"> NOTE: </span><div class="notebody"><p id="obs_11_0014__p6603633154818">If this parameter is not configured, the display format of bytes in the result is determined by the <strong id="obs_11_0014__b12496171034012">humanReadableFormat</strong> parameter in the configuration file.</p>
</div></div>
</td>
</tr>
<tr id="obs_11_0014__row1034019721815"><td class="cellrowborder" valign="top" width="18.19%" headers="mcps1.3.4.2.1.4.1.1 "><p id="obs_11_0014__p0340167181811">du</p>
</td>
<td class="cellrowborder" valign="top" width="26.16%" headers="mcps1.3.4.2.1.4.1.2 "><p id="obs_11_0014__p434018718188">Optional (additional parameter)</p>
</td>
<td class="cellrowborder" valign="top" width="55.65%" headers="mcps1.3.4.2.1.4.1.3 "><p id="obs_11_0014__p1934012791815">Quickly returns the total size of listed objects, without displaying detailed object information. This parameter can be used together with other parameters.</p>
<div class="note" id="obs_11_0014__note15561346153618"><span class="notetitle"> NOTE: </span><div class="notebody"><p id="obs_11_0014__p1561446173617">If there are too many objects listed, wait for a while.</p>
</div></div>
<div class="caution" id="obs_11_0014__note1756975243612"><span class="cautiontitle"> CAUTION: </span><div class="cautionbody"><ul id="obs_11_0014__ul0180655133620"><li id="obs_11_0014__li84645618366">This parameter is only supported by obsutil 5.4.6 and later.</li></ul>
</div></div>
</td>
</tr>
<tr id="obs_11_0014__row23091241125114"><td class="cellrowborder" valign="top" width="18.19%" headers="mcps1.3.4.2.1.4.1.1 "><p id="obs_11_0014__p1918111241654">limit</p>
</td>
<td class="cellrowborder" valign="top" width="26.16%" headers="mcps1.3.4.2.1.4.1.2 "><p id="obs_11_0014__p218113247513">Optional (additional parameter)</p>
</td>
<td class="cellrowborder" valign="top" width="55.65%" headers="mcps1.3.4.2.1.4.1.3 "><p id="obs_11_0014__p310214615616">The maximum number of objects that can be listed. If the value is less than or equal to 0, all objects are listed. If it is left blank, 1,000 objects are listed by default.</p>
<div class="note" id="obs_11_0014__note1997814166384"><span class="notetitle"> NOTE: </span><div class="notebody"><p id="obs_11_0014__p17979111612385">If there are a large number of objects in a bucket, you are advised to set this parameter to limit the number of objects to be listed each time. If not all objects are listed, <strong id="obs_11_0014__b1440343663211">marker</strong> and <strong id="obs_11_0014__b350211407322">versionIdMarker</strong> of the next request will be returned in the result, which you can use to list the remaining objects.</p>
</div></div>
</td>
</tr>
<tr id="obs_11_0014__row1457133181815"><td class="cellrowborder" valign="top" width="18.19%" headers="mcps1.3.4.2.1.4.1.1 "><p id="obs_11_0014__p114391014518">bucket-cname</p>
</td>
<td class="cellrowborder" valign="top" width="26.16%" headers="mcps1.3.4.2.1.4.1.2 "><p id="obs_11_0014__p4143210950">Optional (additional parameter)</p>
</td>
<td class="cellrowborder" valign="top" width="55.65%" headers="mcps1.3.4.2.1.4.1.3 "><p id="obs_11_0014__p16143610251">The user-defined domain name bound to the bucket</p>
<div class="note" id="obs_11_0014__note13958135187"><span class="notetitle"> NOTE: </span><div class="notebody"><p id="obs_11_0014__p4958123151812">This parameter is only supported by obsutil 5.7.9 and later.</p>
</div></div>
</td>
</tr>
<tr id="obs_11_0014__row1095422313515"><td class="cellrowborder" valign="top" width="18.19%" headers="mcps1.3.4.2.1.4.1.1 "><p id="obs_11_0014__p153951131317">config</p>
</td>
<td class="cellrowborder" valign="top" width="26.16%" headers="mcps1.3.4.2.1.4.1.2 "><p id="obs_11_0014__p12395135316">Optional (additional parameter)</p>
</td>
<td class="cellrowborder" valign="top" width="55.65%" headers="mcps1.3.4.2.1.4.1.3 "><p id="obs_11_0014__obs_11_0008_p1750111452317">The user-defined configuration file for executing the current command. For details about parameters that can be configured, see <a href="obs_11_0035.html">Configuration Parameters</a>.</p>
</td>
</tr>
<tr id="obs_11_0014__row23394417262"><td class="cellrowborder" valign="top" width="18.19%" headers="mcps1.3.4.2.1.4.1.1 "><p id="obs_11_0014__p1966666191820">payer</p>
</td>
<td class="cellrowborder" valign="top" width="26.16%" headers="mcps1.3.4.2.1.4.1.2 "><p id="obs_11_0014__p1266611611820">Optional (additional parameter)</p>
</td>
<td class="cellrowborder" valign="top" width="55.65%" headers="mcps1.3.4.2.1.4.1.3 "><p id="obs_11_0014__p1166617619181">Specifies that requester pays is enabled.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section" id="obs_11_0014__section6926520122416"><h4 class="sectiontitle">Response</h4>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="obs_11_0014__table992610203244" frame="border" border="1" rules="all"><thead align="left"><tr id="obs_11_0014__row892913208248"><th align="left" class="cellrowborder" valign="top" width="21.7%" id="mcps1.3.5.2.1.3.1.1"><p id="obs_11_0014__p1392992019245">Field</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="78.3%" id="mcps1.3.5.2.1.3.1.2"><p id="obs_11_0014__p19318207246">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="obs_11_0014__row79320208248"><td class="cellrowborder" valign="top" width="21.7%" headers="mcps1.3.5.2.1.3.1.1 "><p id="obs_11_0014__p1093217203246">Key</p>
</td>
<td class="cellrowborder" valign="top" width="78.3%" headers="mcps1.3.5.2.1.3.1.2 "><p id="obs_11_0014__p18753151115409">The object name</p>
</td>
</tr>
<tr id="obs_11_0014__row1753615812247"><td class="cellrowborder" valign="top" width="21.7%" headers="mcps1.3.5.2.1.3.1.1 "><p id="obs_11_0014__p15536155820245">LastModified</p>
</td>
<td class="cellrowborder" valign="top" width="78.3%" headers="mcps1.3.5.2.1.3.1.2 "><p id="obs_11_0014__p362281284312">The time when the last modification was made to the object</p>
</td>
</tr>
<tr id="obs_11_0014__row98643152253"><td class="cellrowborder" valign="top" width="21.7%" headers="mcps1.3.5.2.1.3.1.1 "><p id="obs_11_0014__p8864415102517">Size</p>
</td>
<td class="cellrowborder" valign="top" width="78.3%" headers="mcps1.3.5.2.1.3.1.2 "><p id="obs_11_0014__p2018474217359">The object size</p>
</td>
</tr>
<tr id="obs_11_0014__row14992172352513"><td class="cellrowborder" valign="top" width="21.7%" headers="mcps1.3.5.2.1.3.1.1 "><p id="obs_11_0014__p69926234252">StorageClass</p>
</td>
<td class="cellrowborder" valign="top" width="78.3%" headers="mcps1.3.5.2.1.3.1.2 "><p id="obs_11_0014__p3250135316288">The storage class of an object. Possible values are:</p>
<ul id="obs_11_0014__ul175651814214"><li id="obs_11_0014__li1256512172114"><strong id="obs_11_0014__b498911125493">standard</strong>: Standard storage class. It features low access latency and high throughput, and is applicable to storing frequently accessed data (multiple accesses per month) or data that is smaller than 1 MB.</li><li id="obs_11_0014__li10565181142113"><strong id="obs_11_0014__b634413354914">warm</strong>: Warm storage class. It is ideal for storing infrequently accessed (less than 12 times a year) data, but when needed, the access has to be fast.</li><li id="obs_11_0014__li756616110216"><strong id="obs_11_0014__b662163616499">cold</strong>: Cold storage class. It provides secure, durable, and inexpensive storage for rarely-accessed (once a year) data.</li></ul>
</td>
</tr>
<tr id="obs_11_0014__row1272082862513"><td class="cellrowborder" valign="top" width="21.7%" headers="mcps1.3.5.2.1.3.1.1 "><p id="obs_11_0014__p4720528142516">ETag</p>
</td>
<td class="cellrowborder" valign="top" width="78.3%" headers="mcps1.3.5.2.1.3.1.2 "><p id="obs_11_0014__p2045185071612">The ETag of an object, which is a Base64-encoded 128-bit MD5 digest. ETag is the unique identifier of the object content. It can be used to determine whether the object content is changed. For example, if the ETag value is <strong id="obs_11_0014__b14799201910164">A</strong> when an object is uploaded, but this value has changed to <strong id="obs_11_0014__b279961913169">B</strong> when the object is downloaded, it indicates that the object content has been changed. The ETag reflects changes to the object content, rather than the object metadata. An uploaded object or copied object has a unique ETag.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="obs_11_0012.html">Object Commands</a></div>
</div>
</div>