Modulify

List storage files

list_storage_files

Browses a site's storage bucket one folder at a time, returning the folders and files directly under a path.

Each file comes back with its key, size, last modified date and visibility, and each folder with its visibility and whether it is mixed. Keys are what every other storage tool takes, so start here. It keeps working while a storage backup is being restored.

Read visibility to tell public from private, never the url field. Only image files carry a url: for a public image it is the permanent CDN address, or a signed link that works for 7 days while the CDN is still being provisioned, and for a private image it is a signed preview that expires after 15 minutes and must never be embedded in a page or stored. A public file without a url is still served at its CDN address, and a private file has no public address at all, so use get_storage_file_url for a link to any file.

A page holds up to 50 entries and comes back with a nextToken, which you pass as token to read the next page. If a token is refused with a 400, list the folder again from the first page.

Pass search instead of path to scan the bucket for keys containing that text anywhere, folder path included, so a search for invoices also finds every file inside an invoices folder. It returns a flat list of up to 200 matches and no folders. That scan reads at most 5,000 objects, shared between public and private files, and sets truncated to true when it stopped before covering the whole bucket, so an empty result with truncated set is inconclusive rather than proof the file is absent, and browsing by path is the sure way to find it.

The CMS folder at the top level holds the files uploaded from CMS fields, and the CMS manages it. This tool lists it like any other folder, but nothing can be uploaded into it, deleted from it, moved in or out of it or changed in visibility, and a CMS file is deleted with the item that uses it. See The CMS folder.

Inputs

Input Type Required Description
projectId string Yes The site id, from list_sites.
path string No The folder to list, such as images/logos/. Leave it out or pass an empty string for the top level of the bucket.
token string No The nextToken from a previous response, to read the next page of the same folder.
search string No Text to find anywhere in a file key, folder path included, across the whole bucket instead of listing one folder. Case insensitive, and path is ignored while it is set.