View the object list

Last Updated: Oct 10, 2017

You can use this feature to view the objects uploaded to your bucket. Up to 1,000 objects in a selected bucket can be displayed at one time. The following four parameters provide users with extended capabilities:

Name Function
Delimiter Groups object name characters. All objects whose names are found between the specified prefix and the first occurrence of the Delimiter act as a group of elements: CommonPrefixes.
Marker Sets up the returned results to begin from the first entry after the Marker, and is sorted in alphabetical order.
MaxKeys Limits the maximum number of objects returned for one request. If this parameter specified, the default value is 100. The MaxKeys value cannot exceed 1,000.
Prefix Indicates that only the objects whose keys contain the specified prefix are returned. Note that keys returned from queries using a prefix will still contain the prefix.

Folder simulation

OSS does not support folders, or directory sorting. All elements are stored as objects. Creating a simulated folder means creating an object with a size of 0 that can then be uploaded and downloaded. The console will display any object ending with “/“ as a folder.

Users can use a combination of Delimiters and Prefixes to simulate folder functions as follows:

  • Setting the Prefix as the name of a folder enumerates the files starting with this prefix, recursively returning all files and subfolders (directories) in this folder. The file names are shown in Contents.
  • Setting the Delimiter as “/“ means the returned values will enumerate the files in the folder and the subfolders (directories) will be returned in the CommonPrefixes section. Recursive files and folders in subfolders will not be displayed.
  1. For example:
  2. In this example, the OSS bucket oss-sample, contains the following objects:
  3. File D
  4. Directory A/File C
  5. Directory A/File D
  6. Directory A/Directory B/File B
  7. Directory A/Directory B/Directory C/File A
  8. Directory A/Directory C/File A
  9. Directory A/Directory D/File B
  10. Directory B/File A
  11. 1. List first-level directories and files
  12. Based on the API request conventions, you must set the Prefix to "", and the Delimiter to "/":
  13. The returned results are as follows:
  14. <?xml version="1.0" encoding="UTF-8"?>
  15. <ListBucketResult>
  16. <Name>oss-sample</Name>
  17. <Prefix></Prefix>
  18. <Marker></Marker>
  19. <MaxKeys>1000</MaxKeys>
  20. <Delimiter>/</Delimiter>
  21. <IsTruncated>false</IsTruncated>
  22. <Contents>
  23. <Key>File D</Key>
  24. <LastModified>2015-11-06T10:07:11.000Z</LastModified>
  25. <ETag>"8110930DA5E04B1ED5D84D6CC4DC9080"</ETag>
  26. <Type>Normal</Type>
  27. <Size>3340</Size>
  28. <StorageClass>Standard</StorageClass>
  29. <Owner>
  30. <ID>oss</ID>
  31. <DisplayName>oss</DisplayName>
  32. </Owner>
  33. </Contents>
  34. <CommonPrefixes>
  35. <Prefix>Directory A/</Prefix>
  36. </CommonPrefixes>
  37. <CommonPrefixes>
  38. <Prefix>Directory B/</Prefix>
  39. </CommonPrefixes>
  40. </ListBucketResult>
  41. We can see that:
  42. Contents returns the first-level file: "File D".
  43. CommonPrefixes returns the first-level directories: "Directory A/" and "Directory B/", but the files in these directories are not shown.
  44. 2. List second-level directories and files under Directory A
  45. Based on the API request conventions, you must set the Prefix to "Directory A", and the Delimiter to "/":
  46. The returned results are as follows:
  47. <?xml version="1.0" encoding="UTF-8"?>
  48. <ListBucketResult>
  49. <Name>oss-sample</Name>
  50. <Prefix>Directory A/</Prefix>
  51. <Marker></Marker>
  52. <MaxKeys>1000</MaxKeys>
  53. <Delimiter>/</Delimiter>
  54. <IsTruncated>false</IsTruncated>
  55. <Contents>
  56. <Key>Directory A/File C</Key>
  57. <LastModified>2015-11-06T09:36:00.000Z</LastModified>
  58. <ETag>"B026324C6904B2A9CB4B88D6D61C81D1"</ETag>
  59. <Type>Normal</Type>
  60. <Size>2</Size>
  61. <StorageClass>Standard</StorageClass>
  62. <Owner>
  63. <ID>oss</ID>
  64. <DisplayName>oss</DisplayName>
  65. </Owner>
  66. </Contents>
  67. <Contents>
  68. <Key>Directory A/File D</Key>
  69. <LastModified>2015-11-06T09:36:00.000Z</LastModified>
  70. <ETag>"B026324C6904B2A9CB4B88D6D61C81D1"</ETag>
  71. <Type>Normal</Type>
  72. <Size>2</Size>
  73. <StorageClass>Standard</StorageClass>
  74. <Owner>
  75. <ID>oss</ID>
  76. <DisplayName>oss</DisplayName>
  77. </Owner>
  78. </Contents>
  79. <CommonPrefixes>
  80. <Prefix>Directory A/Directory B/</Prefix>
  81. </CommonPrefixes>
  82. <CommonPrefixes>
  83. <Prefix>Directory A/Directory C/</Prefix>
  84. </CommonPrefixes>
  85. <CommonPrefixes>
  86. <Prefix>Directory A/Directory D/</Prefix>
  87. </CommonPrefixes>
  88. </ListBucketResult>
  89. We can see that:
  90. Contents returns the second-level files: "Directory A/File C" and "Directory A/File D".
  91. CommonPrefixes returns the second-level directories: "Directory A/Directory B/", "Directory A/Directory C/", and "Directory A/Directory D/". The file names under these directories are not shown.

Reference

Thank you! We've received your feedback.