tencent cloud

Smart Media Hosting

List Content

PDF
フォーカスモード
フォントサイズ
最終更新日: 2026-01-07 11:03:09

Introduction

This document provides an API overview for listing directory or album content and SDK sample code.
API
Operation Description
List directory or album content

Listing Directory or Album

Feature Overview

List directory or album content.

Example Code

File List
//target folder
val targetDir = Directory()
try {
val directoryContents: DirectoryContents = smh.list(
//target directory
dir = targetDir,
page number
page = 1,
items per page
pageSize = 100,
sorting method
orderType = OrderType.NAME,
sorting order
orderDirection = OrderDirection.ASC,
filter type
directoryFilter = DirectoryFilter.ONLY_FILE
)
//file/directory list check other numbers etc. in DirectoryContents entity
val contents = directoryContents.contents
} catch (e: Exception) {
e.printStackTrace()
}
List file list via marker + limit
//target folder
val targetDir = Directory()
try {
val directoryContents: DirectoryContents = smh.listWithMarker(
//target directory
dir = targetDir,
//Used to list paginated identification sequentially
marker = 100,
//Used to limit the local project count for sequential paginated listing
limit = 100,
//ETag of current directory
eTag = "eTag",
sorting method
orderType = OrderType.NAME,
sorting order
orderDirection = OrderDirection.ASC,
filter type
directoryFilter = DirectoryFilter.ONLY_FILE
)
//file/directory list check other numbers etc. in DirectoryContents entity
val contents = directoryContents.contents
} catch (e: Exception) {
e.printStackTrace()
}
List file list via offset + limit
//target folder
val targetDir = Directory()
try {
val directoryContents: DirectoryContents = smh.listWithOffset(
//target directory
dir = targetDir,
//file offset
offset = 100,
//the number of list
limit = 100,
sorting method
orderType = OrderType.NAME,
sorting order
orderDirection = OrderDirection.ASC,
filter type
directoryFilter = DirectoryFilter.ONLY_FILE
)
//file/directory list check other numbers etc. in DirectoryContents entity
val contents = directoryContents.contents
} catch (e: Exception) {
e.printStackTrace()
}
List all files
//target folder
val targetDir = Directory()
try {
val directoryContents: DirectoryContents = smh.listAll(
//target directory
dir = targetDir,
items per page
pageSize = 100,
sorting method
orderType = OrderType.NAME,
sorting order
orderDirection = OrderDirection.ASC,
filter type
directoryFilter = DirectoryFilter.ONLY_FILE
)
//file/directory list check other numbers etc. in DirectoryContents entity
val contents = directoryContents.contents
} catch (e: Exception) {
e.printStackTrace()
}
List all files via marker + limit
//target folder
val targetDir = Directory()
try {
val directoryContents: DirectoryContents = smh.listAllWithMarker(
//target directory
dir = targetDir,
items per pull
limit = 100
)
//file/directory list check other numbers etc. in DirectoryContents entity
val contents = directoryContents.contents
} catch (e: Exception) {
e.printStackTrace()
}


ヘルプとサポート

この記事はお役に立ちましたか?

フィードバック