Temporarily deletes the specified folders from the Media Manager.
The bulkDeleteFolders()
function returns a Promise that resolves when the folders are deleted.
The deleted folders are moved to the Media Manager's TRASH_ROOT
folder (trash bin) unless permanently deleted. To permanently delete folders, pass the permanent
parameter with the value true
. Permanently deleting folders isn't reversible, so make sure that the files in these folders aren't being used in a site or in any other way as the files will no longer be accessible.
Notes:
bulkRestoreFoldersFromTrashBin()
function to restore folders from the Media Manager's trash bin.This function requires elevated permissions and runs only on the backend and on dashboard pages.
function bulkDeleteFolders(
folderIds: Array<string>,
options: BulkDeleteFoldersOptions,
): Promise<void>;
IDs of the folders to move to the Media Manager's trash bin.
Options to use when deleting folders.
import { folders } from "wix-media.v2";
/* Sample folderIds value:
* [
* '302fc049d70c41dea33fa4a27ab481ba',
* 's8ze556gf8wfao3us62nx25ww3lr595a'
* ]
*/
async function myBulkDeleteFoldersFunction(folderIds) {
try {
const deletedFolders = await folders.bulkDeleteFolders(folderIds);
console.log("Successfully moved folders to trash.");
return deletedFolders;
} catch (error) {
console.error(error);
// Handle the error
}
}
/* Promise resolves to void */
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.