Moves single or multiple folders, including their files and sub-folders, to the Media Manager's trash.
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.
function moveFoldersToTrash(folderIds: Array<string>): Promise<void>;
IDs of the folders to move to trash.
import { Permissions, webMethod } from "wix-web-module";
import { mediaManager } from "wix-media-backend";
/* Sample folderIds array:
* [
* 'de4e7c3258f444e9a506a8572d951ddf',
* 'a2597566072c463492f9963c377f3f74'
* ]
*/
export const myMoveFoldersToTrashFunction = webMethod(
Permissions.Anyone,
(folderIds) => {
return mediaManager
.moveFoldersToTrash(folderIds)
.then(() => {
console.log("Success! Folders have been trashed.");
})
.catch((error) => {
console.error(error);
});
},
);
/**
* Returns a promise that resolves to <void>
**/
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.