Skip to content

Move a directory #17

@Xkonti

Description

@Xkonti

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

  • Verb: POST
  • Path: /dir/move

Query parameters:

Name Value Default value Description
source string required A path to a directory which should be moved.
destination string required A new path for the directory.
merge true or false false Whether to merge contents of the source directory with existing contents of the destination path.
overwrite true or false false Whether to overwrite existing destination files when merging or simply skip them.

Responses:

  • 204 No Content - when the directory was successfully moved without merging enabled.
  • 200 OK - when a directory was successfully moved with merging is enabled.
  • 404 Not Found - when couldn't find the directory or if the path is pointing to a file.
  • 400 Bad Request - when the path is invalid or when the new path is invalid.

Extra info

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

User can request to move directory /docs/private/poetry to /docs/private/hidden/art. That means that:

  1. Directory hidden needs to be created
  2. Directory art needs to be created
  3. Contents of poetry needs to be moved to the art directory.
  4. The now empty poetry directory needs to be deleted.

This will essentially rename the poetry directory to art and then move it to the new hidden directory.

Merging

This endpoint should allow for merging the content of the source directory with content that already exists in a destination folder.

  • When overwrite is set to false the files that exist in both source and destination will not be moved. The list of those files needs to be returned in response body.
  • When overwrite is set to true the files that exist in both source and destination will be overwritten with the contents of those from the source. Those files will be removed from the source folder (moved). The list of those overwritten files needs to be returned in response body.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions