ListFiles(path, [searchPattern], [tags], [recursive], [metaOnly]) Last updated: 08. Oct 2024

The fastes function to retreive a list of files from a specific path.

Parameters

Name Type Description
path string Date on which to add days to.
searchPattern (optional) string Wildcard for search, default is *.
If not specified, all files will be returned.
tags (optional) bool Retreive tags. Default "false", specify "true" to retreive tags.
recursive (optional) bool Return files from all subfolders also.
If not specified, default is "false".
metaOnly (optional) bool Do not return values for files.
If not specified, default is "false".

Returns

A modified date, does not modify input date.

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" */
    var files = docly.listFiles("/Test files", "example*");
    
    /* 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"
}
-----------------------------