listFiles(path, [options]) Last updated: 10. Aug 2026

The fastest function to retrieve a list of files from a specific path.

See also: getTags addTag Path traversal

Parameters

Name Type Description
path string

Folder path to get list of files from.

options (optional)objectSpecify any of the following options parameters:
name string

Wildcard for search, default is *. If not specified, all files will be returned.

tags bool

Retrieve tags. Default "false", specify "true" to retrieve tags. Not to be confused with tag below — tags decides whether the tags come with the result, tag filters on them.

recursive bool

Return files from all subfolders also. If not specified, default is "false".

metaOnly bool

Do not return values for files. If not specified, default is "false".

schema string

Enter a wildcard of schemas to retrieve, default is "*"

filter object

Property filter object (e.g. { "Status": "active" })

tag string

Only return files carrying this tag. The value is normalized exactly as tags are when they are stored, so "Invoice" finds the stored tag invoice. A value of several words requires all of them, and a value that normalizes to nothing (a single character, punctuation only) returns an empty result rather than everything. Filtering happens in the database, not on the returned array. See addTag.

Returns

An array of file objects containing information about the files in the specified path.

Example

Code example (#JS)

#JS is mixed HTML (or other text file) with inline JavaScript with # starting and ending each inline statement.
#{
    /* Get all files starting with "example" */
    let options = { name : "example*" };
    let files = docly.listFiles("/Test files", options);
    
    /* List all files */
    for(let file of files)
    {
        var json = JSON.stringify(file);
        var html = JSON.format(json).replace(chr(13), "");
        write(html);
        write(chr(13) + "-----------------------------" + chr(13));
    }
}#

Output

The #JS code above produces the output shown below:
{
  "Id": 167557,
  "Guid": "sAdeLq7IJ0CERkggJGIU7A",
  "Name": "Example file.xlsx",
  "Values": {
    "File": "0a4bdde7-e796-4e51-859b-2b7ba13c6f35.xlsx"
  },
  "Modified": "2022-12-20T19:11:02.4906438+01:00",
  "Schema": "Uploaded File",
  "ModifiedBy": "r@dops.no",
  "Path": null
}
-----------------------------