drive.getFiles(path, [options])
Lists every file below a folder the way it appears on a mapped Docly drive — with the file names and extensions a drive or an export uses. Use it together with drive.getFile to export or zip a part of the site. Called as drive.getFiles(...).
Parameters
pathstringrequiredFolder path from the site root.
optionsobjectoptionalrecursiveboolHas no effect at present: all files at every level below the folder are always returned.
Returns
An array of objects with Name, Path (relative to the folder you asked for), FolderPath (the folder part of Path), ExportName (the name with the extension the file gets on a drive, such as .docly for a schema document), Filesize, Modified and Created.
Folder properties documents are included; their Name is empty. Deleted files are left out. No access check is made. null when the path is empty or the folder does not exist.
Example
// Zip everything below /Documents and download it
let files = drive.getFiles("/Documents");
let zip = {};
for (let f of files) {
if (!f.Name) continue; // skip folder properties documents
let name = f.FolderPath ? f.FolderPath + "/" + f.ExportName : f.ExportName;
zip[name] = drive.getFile("Documents/" + f.Path);
}
docly.downloadBytes(docly.createZip(zip), "documents.zip");