Docly Developers
Function API only Updated 23 Oct 2026

moveFile(filePath, toPath)

Moves a file into another folder. The file keeps its name — use renameFile to change the name.

Parameters

filePathstringrequired

Entire absolute path for file to move.

toPathstringrequired

Path to the folder to move the file into, from the site root. This is always a folder, never a new file name.

Returns

The same as docly.getFile for the file at its new location. If the file is already in the target folder, nothing is moved and the file is returned as it is. Throws if the file or the target folder is not found, or if either only exists in the app the site is published from (error 110).

Example

Normal JavaScript, running in the browser or on the Docly™ server.
// Moves the file and keeps its name
let result = docly.moveFile("Folder/File1.json", "Folder2");

write(result.filepath);