Endpoint:
PUT /file/move/:filename
Description:
This endpoint allows you to move a file from its current location to a specified directory. The file is searched across all configured storage directories and moved to the target directory specified in the storage header.
| Key | Type | Description |
|---|---|---|
| filename | String | The name of the file to move |
| Key | Type | Description |
|---|---|---|
| storage | String | The target directory path where the file should be moved |
- Set the request method to PUT.
- Set the URL to:
{{url}}/file/move/example.pdf - In the Headers tab, add:
- Key:
storage - Value:
smarterp/documents(or your desired target directory)
- Key:
- Click Send to move the file.
curl -X PUT "{{url}}/file/move/example.pdf" \
-H "storage: smarterp/documents"Success (200):
{
"message": "File moved successfully",
"status": 200,
"data": {
"oldPath": "/storage/previous/location/example.pdf",
"newPath": "/storage/smarterp/documents/example.pdf"
}
}Error Responses:
Bad Request (400) - Missing parameters:
{
"message": "filename and targetDir are required.",
"status": 400
}Not Found (404) - File not found:
{
"message": "File not found.",
"status": 404
}Bad Request (400) - Move operation failed:
{
"message": "Failed to move file.",
"status": 400
}- The file is automatically searched across all configured storage directories
- The target directory will be created if it doesn't exist
- Proper file and directory permissions are set automatically after the move
- The service is automatically reloaded after a successful move operation
- If a file with the same name already exists in the target directory, the operation may fail