getFile(filepath, [metadata]) Last updated: 29. Apr 2026

Gets information about a specific file.

See also: getFiles getJson fileExists GetFiles and Folders examples

Parameters

Name Type Description
filepath string Absolute path of file to get information about (relative paths are not supported in Docly).
metadata (optional) bool Default true. Merges meta data about the document with the document data.

Returns

Structure with file info, see demo.

Example

Code example (#JS)

#JS is mixed HTML (or other text file) with inline JavaScript with # starting and ending each inline statement.
#{
    let file = docly.getFile("Test files/Example file.xlsx", true);
    var json = JSON.stringify(file);
    
    // Format indent and line breaks in JSON
    var pretty = docly.formatJson(json);
    
    // Remove empty lines
    var html = pretty.replace(chr(13), "");
    
    write(html);
}#

Output

The #JS code above produces the output shown below:
{
  "File": "0a4bdde7-e796-4e51-859b-2b7ba13c6f35.xlsx",
  "Title": "Example file.xlsx",
  "opendoc": "https://docly.net/#DsAdeLq7IJ0CERkggJGIU7A?backurl=https%3a%2f%2fdevelopers.docly.net%2fJavaScript%2fFilesystem-functions%2fgetFile",
  "Url": "/Test-files/Example-file.xlsx",
  "FormName": "Uploaded File",
  "DoclyTypeId": 1,
  "DoclyTimestamp": "638071602624906438",
  "Tags": [],
  "LastModifiedBy": "r@dops.no",
  "folderpath": "/Test files",
  "filename": "Example file.xlsx",
  "filepath": "/Test files/Example file.xlsx",
  "fileschema": "Uploaded File",
  "file": true,
  "Guid": "sAdeLq7IJ0CERkggJGIU7A",
  "CreatedTime": "2022-12-20T19:09:09.9602572+01:00",
  "LastModified": "2022-12-20T19:11:02.4906438+01:00",
  "Filesize": 5710
}