Skip to content

Copy a file #26

Description

@Xkonti

An endpoint that copies a specified file to a specified path. This can also cause renaming - it's an equivalent of Linux's cp command.

  • Verb: POST
  • Path: /file/copy

Query parameters:

Name Value Default value Description
source string required A path to a file which should be copy.
destination string required A new path for the file.
overwrite true or false false Whether to overwrite if there already is a file at the destination path.

Responses:

  • 204 No Content - when the file was successfully copied.
  • 404 Not Found - when couldn't find the file or if the source is pointing to a directory.
  • 409 Conflict - when there already is a file at the destination path but overwrite is set to false. Also if destination is an existing directory.
  • 400 Bad Request - when the path is invalid or when the new path is invalid.

Extra info

The new path of the file should be also verified with isPathValid to make sure the outcome will be what user expects.

User can request to copy file /docs/private/poetry.md to /docs/private/hidden/art.md. It means that:

  1. Directory hidden needs to be created.
  2. File poetry.md needs to be copied as art.md to the hidden directory.

If the overwrite is set to true and the destination points to an already existing file, it will be overwritten.

Metadata

Metadata

Assignees

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions