tencent cloud

Smart Media Hosting

Product Introduction
Product Overview
Feature Description
Product Strengths
Use Cases
Basic Concept
Purchase Guide
Quick Start
Create Media Library
Initiate request
Service Level API Document
History
Introduction
API Category
Making API Requests
PaaS Service APIs
Official Cloud Disk APIs
Data Types
Error Codes
Business Level API Document
Introduction
Access Token Operation API
Tenant Space Operation API
File Operation API
Directory or Album Operation API
Recycle Bin Operation API
Quota Operation API
Query Task Operation API
Search Operation API
Historical Version Operations API
Directory and File Batch Operation API
Collection Operation API
Error Codes
SDK Documentation
Android SDK
iOS SDK
HarmonyOS SDK
FAQs
Enterprise Network Disk
Product Introduction
Purchase Guide
Quick Start
FAQs
Service Level Agreement
Glossary

Batch Processing

PDF
フォーカスモード
フォントサイズ
最終更新日: 2026-01-07 10:49:15

Introduction

This document provides API introduction about batch processing and example code.

Deleting Directories or Files in Batches

Feature Description

Delete directories or files in batches.

Sample Code

try {
let items :SMHBatchDeleteObject[] = [
{path:`test/key1`,permanent:false},
{path:`test/key2`,permanent:false}
]
let result = await SMHBatchApis.batchDeleteFile({
libraryId: "libraryId",
spaceId: "spaceId",
items: items
});
} catch (e) {
// Exception handling
}

Parameter Description

Request parameters.
Description
Type
Required or Not
libraryId
Media Library ID, obtain it after creating a media library in the media hosting console, see Create Media Library
String
Yes
spaceId
Space ID. If the media library is in single-tenant mode, this parameter is fixed as hyphen (`-`); if the media library is in multi-tenant mode, you must specify this parameter. See Create Tenant Space
String
No
items
Set of batch operations
SMHBatchDeleteObject array
Yes
path
Deleted directory, album, or file path
String
Yes
permanent
When the recycle bin is enabled, this parameter specifies whether to move files to the recycle bin or permanently delete them. true: permanently delete, false: move to recycle bin, default to false.
Bool
Yes

Batch Copying Directories or Files

Feature Description

Batch copy directories or files.

Sample Code

try {
let items :SMHBatchCopyObject[] = [
{copyFrom:`test/key1`,to:`test/key1_copy`},
{copyFrom:`test/key2`,to:`test/key2_copy`},
]
let result = await SMHBatchApis.batchCopyFile({
libraryId: "libraryId",
spaceId: "spaceId",
items: items
});
} catch (e) {
// Exception handling
}

Parameter Description

Request parameters.
Description
Type
Required or Not
libraryId
Media Library ID, obtain it after creating a media library in the media hosting console, see Create Media Library
String
Yes
spaceId
Space ID. If the media library is in single-tenant mode, this parameter is fixed as hyphen (`-`); if the media library is in multi-tenant mode, you must specify this parameter. See Create Tenant Space
String
No
items
Set of batch operations
SMHBatchCopyObject array
Yes
to
Target directory, album, or file path, such as foo/bar/file_new.docx
String
Yes
copyFrom
Source directory, album, or file path to be copied
String
Yes
copyFromSpaceId
Specify the space where the source directory or file is located when copying across spaces. Do not specify this field when copying within the same space.
String
No
conflictResolutionStrategy
Handling method for filename conflict: if the target is a directory or album, it defaults to ask and does not support overwrite; if the target is a file, it defaults to rename.
conflicts with return
status: 409 and SameNameDirectoryOrFileExists error code
rename file automatically when conflicts with
overwrite: return status 409 and SameNameDirectoryOrFileExists error code if the target is a directory when conflict occurs, otherwise overwrite the existing file
SMHConflictResolutionStrategy
No

Batch Renaming or Moving Directories/Files

Feature Description

Batch rename or move directories/files.

Sample Code

try {
let items :SMHBatchMoveObject[] = [
{from:`test/key1`,to:`test/key1_move`},
{from:`test/key2`,to:`test/key2_move`},
]
let result = await SMHBatchApis.batchMoveFile({
libraryId: "libraryId",
spaceId: "spaceId",
items: items
});
} catch (e) {
// Exception handling
}

Parameter Description

Request parameters.
Description
Type
Required or Not
libraryId
Media Library ID, obtain it after creating a media library in the media hosting console, see Create Media Library
String
Yes
spaceId
Space ID. If the media library is in single-tenant mode, this parameter is fixed as hyphen (`-`); if the media library is in multi-tenant mode, you must specify this parameter. See Create Tenant Space
String
No
items
Set of batch operations
SMHBatchMoveObject array
Yes
to
Target directory, album, or file path, such as foo/bar/file_new.docx
String
Yes
from
Source directory, album, or file path to be renamed or moved
String
Yes
copyFromSpaceId
Specify the space where the source directory or file is located when moving across spaces. Do not specify this field when moving within the same space.
String
No
conflictResolutionStrategy
Handling method for filename conflict: if the target is a directory or album, it defaults to ask and does not support overwrite; if the target is a file, it defaults to rename.
ask: return when conflicts with
status: 409 and SameNameDirectoryOrFileExists error code
rename file automatically when conflicts with
overwrite: return status 409 and SameNameDirectoryOrFileExists error code if the target is a directory when conflict occurs, otherwise overwrite the existing file
SMHConflictResolutionStrategy
No

ヘルプとサポート

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

フィードバック