Docly Developers
Function Updated 25 Oct 2026

getFilenames(path, [options])

Returns the names of the files in a folder — a lighter alternative to listFiles when the names are all you need. Only the folder itself is read, not its subfolders.

Parameters

pathstringrequired

Folder path from the site root. An empty string means the site root.

optionsobjectoptional
Specify any of the following options parameters:
searchPatternstring

Wildcard for the file name, default "*". abc*, *abc and *abc* work, and matching is not case sensitive.

Returns

An array of file names (strings), as they are stored in Docly. Folder properties files and index.* files are left out. An unknown folder, or a folder the site's publisher has no website (Visit) access to, gives an empty array; a path containing .. or a backslash gives null. Access is that of the user who published the site — the user the site runs as — not of the visitor, so the result is the same for everyone. To tailor a list to the signed-in visitor in an API script, check each item with allowVisit.

Example

Normal JavaScript, running in the browser or on the Docly™ server.
// List the PDF files in a folder
let names = docly.getFilenames("/Documents", "*.pdf");

for (let name of names)
    write(name + "\n");