moveFile(filePath, toPath) Last updated: 13. May 2026

API only function

Moves a file from one folder to another, and renames it if the name part of the path is changed.

See also: Path traversal

Parameters

Name Type Description
filePath string

Entire absolute path for file to move.

toPath string

Absolute path to folder to place the file into.

Returns

Returns same as "docly.getFile" function for the updated file after moving.

Example

Code example (JS)

JS is normal JavaScript either running in the browser or on the Docly™ server.
// Moves file and keeps the name, specify folder path
let result = docly.moveFile("Folder/File1.json", "Folder2");

write(result);