Skip to content

Copy a directory #18

@Xkonti

Description

@Xkonti

An endpoint that copies a specified directory to a specified path.

  • Verb: POST
  • Path: /dir/copy

Query parameters:

Name Value Default value Description
source string required A path to a directory which should be copied.
destination string required A path of the directory contents to be copied to.
merge true or false false Whether to merge contents of the copied 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 copied without merging enabled.
  • 200 OK - when a directory was successfully copied with merging is enabled.
  • 404 Not Found - when couldn't find the directory or if the path is pointing to a file.
  • 409 Conflict - when directory with same name already exists and the merge 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 directory copy should be also verified with isPathValid to make sure the outcome will be what user expects.

User can request to copy 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 copied to the art 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 copied. 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. 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