Skip to content

Move a file #25

@Xkonti

Description

@Xkonti

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

  • Verb: POST
  • Path: /file/move

Query parameters:

Name Value Default value Description
source string required A path to a file which should be moved.
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 moved.
  • 404 Not Found - when couldn't find the file or if the path is pointing to a directory.
  • 409 Conflict - when there already is a file at the destination path but overwrite is set to false.
  • 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 move 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.
  3. File poetry.md needs to be deleted.

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions