Search.../

moveFoldersToTrash( )

Moves single or multiple folders, including their files and sub-folders, to the Media Manager's trash.

Description

The moveFoldersToTrash() function returns a Promise that resolves when the folder(s) are moved to the Media Manager's trash.

Moving many folders to trash at once is an asynchronous action. It may take some time for the results to be seen in the Media Manager.

Use the Media Manager to restore or permanently delete trashed folders.

Attempting to move already-trashed folders to trash again doesn't result in an error.

Syntax

function moveFoldersToTrash(folderIds: Array<string>): Promise<void>

moveFoldersToTrash Parameters

NAME
TYPE
DESCRIPTION
folderIds
Array<string>

IDs of the folders to move to trash.

Returns

Return Type:

Promise<void>

Was this helpful?

Move a single folder to trash

Copy Code
1import { Permissions, webMethod } from 'wix-web-module';
2import { mediaManager } from 'wix-media-backend';
3
4/* Sample folderIds array:
5 * [
6 * 'de4e7c3258f444e9a506a8572d951ddf',
7 * 'a2597566072c463492f9963c377f3f74'
8 * ]
9 */
10
11export const myMoveFoldersToTrashFunction = webMethod(Permissions.Anyone, (folderIds) => {
12 return mediaManager.moveFoldersToTrash(folderIds)
13 .then(() => {
14 console.log('Success! Folders have been trashed.');
15 })
16 .catch((error) => {
17 console.error(error);
18 })
19});
20
21/**
22 * Returns a promise that resolves to <void>
23 **/