tencent cloud

Smart Media Hosting

Batch Replication

PDF
Modo Foco
Tamanho da Fonte
Última atualização: 2026-01-07 11:03:08

Introduction

This document provides an API overview about batch copying directories or files and SDK sample code.
API
Operation Description
Batch Copy Directories or Files

Batch Copying a Directory or File

Feature Overview

Used for batch copying directories or files.
When replicating projects asynchronously, return HTTP 202 Accepted. When replicating projects synchronously, return HTTP 200 OK (all execution successful) or HTTP 207 Multi-Status (part or all execution failed).

Example Code

Start batch replication
try {
//Files or folders to be copied in batch
val items: List<BatchCopyItem> = listOf(
BatchCopyItem(
//Source directory, album, or file path to be copied
"fromPath",
//Target directory, album, or file path
"toPath",
//Handling method when filename conflict
ConflictStrategy.RENAME
),
BatchCopyItem("fromPath", "toPath", ConflictStrategy.RENAME)
)
//Return batch operation result
//If it is synchronously returned: just obtain the result content directly from batchResponse.result
//If it is asynchronously returned: need to call the Query Task API to get the result content (generally poll the query job until the task result is queried)
val batchResponse: BatchResponse = smh.batchCopy(
items = items
)
} catch (e: Exception) {
e.printStackTrace()
}
Query job For detailed usage, refer to asynchronous processing.

Ajuda e Suporte

Esta página foi útil?

comentários