> Portal Navigation: > > - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version. > - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages). > - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`). > - Top-level index of all portals: https://dev.wix.com/docs/llms.txt > - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt # Method name: listFolders(filters: FolderFilterOptions, sorting: SortingOptions, paging: PagingOptions) # Method package: wixMediaBackend # Method menu location: wixMediaBackend --> MediaManager --> listFolders # Method Link: https://dev.wix.com/docs/velo/apis/wix-media-backend/media-manager/list-folders.md # Method Description: Gets a list of folders from the Media Manager by `parentFolderId` (or root). The `listFolders()` function returns a Promise that resolves to information about the folders in the folder. To get a list of folders within a specific folder in the Media Manager, pass the folder's ID in the `parentFolderId` parameter. If no folder is specified, the `listFolders()` function returns the list of folders in the root folder of the Media Manager. >**Note:** This function's parameters are positional, and must be specified in the sequence shown in the syntax below. When specifying a parameter, use `null` as a placeholder for any unspecified parameters. For example, to specify `parentFolderId` only, call `listFolders(filters, null, null)`. For example, to specify `sorting` only, call `listFolders(null, sorting, null)`. # Method Code Examples: *** Note: do not assume any prop names or enum values other than the ones in the example. ## List folders in a specified folder ```javascript import { Permissions, webMethod } from 'wix-web-module'; import { mediaManager } from 'wix-media-backend'; const filters = { parentFolderId: "8a3be85ea03e4b8b82f2f9c989557c3d" }; export const myListFoldersFunction = webMethod(Permissions.Anyone, () => { return mediaManager.listFolders(filters, null, null) .then((myFolders) => { const folderName = myFolders[0].folderName; const updatedDate = myFolders[1]._updatedDate; return myFolders; }) .catch((error) => { console.error(error); }); }); /* Returns a promise that resolves to: * [{ * "folderId": "1bf317e889264736b5acb367415fad8e", * "folderName": "greatfolder1", * "parentFolderId": "8a3be85ea03e4b8b82f2f9c989557c3d", * "_createdDate": "Sun December 4 2020 14:56:15 GMT+0300", * "_updatedDate": "Wed May 12 2021 14:56:15 GMT+0300" * }, * { * "folderId": "2fj678p889264736b5acb367415fad5g", * "folderName": "greatfolder2", * "parentFolderId": "8a3be85ea03e4b8b82f2f9c989557c3d", * "_createdDate": "Sun December 4 2020 14:56:15 GMT+0300", * "_updatedDate": "Wed May 12 2021 14:56:15 GMT+0300" * }] */ ``` ## List folders in the root folder ```javascript import { Permissions, webMethod } from 'wix-web-module'; import { mediaManager } from 'wix-media-backend'; export const myListFoldersFunction = webMethod(Permissions.Anyone, () => { return mediaManager.listFolders() .then((myFolders) => { const folderName = myFolders[0].folderName; const updatedDate = myFolders[1]._updatedDate; return myFolders; }) .catch((error) => { console.error(error); }); }); /* Returns a promise that resolves to: * [{ * "folderId": "4nm317e889264736b5acb367415fad6b", * "folderName": "folder1", * "parentFolderId": "media-root", * "_createdDate": "Mon August 5 2019 14:56:15 GMT+0300", * "_updatedDate": "Tues May 12 2021 07:28:12 GMT+0300" * }, * { * "folderId": "2t214e889264736b5acb367415fadgc", * "folderName": "folder2", * "parentFolderId": "media-root", * "_createdDate": "Sun December 16 2018 12:22:22 GMT+0300", * "_updatedDate": "Wed June 11 2020 09:34:33 GMT+0300" * }] */ ``` ## Filter, sort, and paginate a list of folders ```javascript import { Permissions, webMethod } from 'wix-web-module'; import { mediaManager } from 'wix-media-backend'; const filters = { parentFolderId: "8292670cf5434db787bdd9715b46b989" }; const sorting = { order: "asc", field: "folderName" }; const paging = { limit: 2, skip: 1 }; export const myListFoldersFunction = webMethod(Permissions.Anyone, () => { return mediaManager.listFolders(filters, sorting, paging) .then((myFolders) => { const folderName = myFolders[0].folderName; const updatedDate = myFolders[1]._updatedDate; return myFolders; }) .catch((error) => { console.error(error); }); }); /* Returns a promise that resolves to: * [{ * "folderId": "1bf317e889264736b5acb367415fad8e", * "folderName": "pictures", * "parentFolderId": "8292670cf5434db787bdd9715b46b989", * "_createdDate": "Sat July 4 2017 10:28:12 GMT+0300", * "_updatedDate": "Wed September 17 2020 09:06:15 GMT+0300" * }, * { * "folderId": "2t214e889264736b5acb367415fadgc", * "folderName": "videos", * "parentFolderId": "8292670cf5434db787bdd9715b46b989", * "_createdDate": "Sun December 16 2018 12:22:22 GMT+0300", * "_updatedDate": "Wed June 11 2020 09:34:33 GMT+0300" * }] */ ``` ---