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

You are reading the documentation of FileRun 2026.4.0, which is not released yet. It is subject to change, so do not use it for planning. Go to the documentation of FileRun 2026.3.0

API: Copying files or folders

Available since FileRun 2026.4.0.

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 a file of the same name at the destination, or to copy a folder into a folder of the same name.

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, and nothing can be copied onto itself ("The target path needs to differ from the source one!").

The response

The copy takes the name of the source, and the response carries its FileRun path in the path property.

  • If the name is free at the destination, the copy is made under it.
  • If the name is taken and overwrite is not set, the request is refused and nothing is copied. The refusal carries conflicts, see below.
  • If the name is taken by a file 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 and to upload into its folder.
  • If the name is taken by a folder and overwrite is set to 1, the copied folder merges into the existing one: its contents are copied inside, and the files of the same names are replaced the same way.
  • A file never replaces a folder, nor a folder a file, at the top or anywhere inside a merged folder ("The folder "report" cannot be replaced by a file!", "The file "report" cannot be replaced by a folder!").

Every check is made before anything is copied, so a refused request leaves the destination as it was.

Example response:

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

The conflicts

A copy refused because a name is taken is answered with the message There is already an item with the same name inside "Documents"! and a conflicts array, one entry per item in the way:

Field Type Description
path string The FileRun path of the source item
filename string The name which is taken
existing string file or folder, what holds the name at the destination
message string A sentence naming the item, such as There is already a file named "report.pdf" inside "Documents"!

A client can show the conflicts and send the request again with overwrite set to 1.