↑↓ to navigate ↵ to open Esc to close Search by Algolia

API: Copying files or folders

Available since FileRun 2026.3.1.

Target URL /api.php/Drive/files/copy
Required scope download + upload
HTTP Method POST
Output format JSON

Request Parameters Reference

Parameter Type Required Description
path string Yes The FileRun path of the file or folder to copy. See this page
copyTo string Yes The FileRun path of the destination folder. See this page
overwrite boolean (1/0) No Set to 1 to replace an existing file of the same name at the destination.

The account needs to be allowed to download the source and to upload into the destination folder. A folder is copied together with its contents. A folder cannot be copied inside itself.

The response

The response carries the FileRun path of the copy in the path property, because the name of the copy is not always the name of the source:

  • If the name is free at the destination, the copy takes the name of the source.
  • If the name is taken and overwrite is not set, the copy is named Copy of <name>, then Copy 2 of <name>, and so on.
  • If the name is taken and overwrite is set to 1, the existing file is replaced. The replaced content is kept as a previous version of the file. If file versioning is turned off, the replaced file is moved to the trash instead. Replacing a file requires that the account is allowed to delete it. When the copy is a folder which already exists at the destination, the copy goes inside the existing folder and the files of the same names inside it are replaced the same way.

Example response:

 1{
 2    "success": true,
 3    "msg": ["..."],
 4    "path": "/ROOT/HOME/Documents/Copy of report.pdf"
 5}