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:
- Directory
hidden needs to be created
- Directory
art needs to be created
- Contents of
poetry needs to be moved to the art directory.
- 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.
An endpoint that moves a specified directory to a specified path. This can also cause renaming - it's an equivalent of Linux's
mvcommand.POST/dir/moveQuery parameters:
sourcedestinationmergetrueorfalsefalseoverwritetrueorfalsefalseResponses:
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
isPathValidto make sure the outcome will be what user expects.User can request to move directory
/docs/private/poetryto/docs/private/hidden/art. That means that:hiddenneeds to be createdartneeds to be createdpoetryneeds to be moved to theartdirectory.poetrydirectory needs to be deleted.This will essentially rename the
poetrydirectory toartand then move it to the newhiddendirectory.Merging
This endpoint should allow for merging the content of the source directory with content that already exists in a destination folder.
overwriteis set tofalsethe files that exist in both source and destination will not be moved. The list of those files needs to be returned in response body.overwriteis set totruethe 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.