Skip to main content
Move or rename a file or directory to a new Viking URI.

Python SDK

from openviking import OpenViking

client = OpenViking()

# Rename a directory
client.mv(
    "viking://resources/old-name/",
    "viking://resources/new-name/"
)

# Move a file to a different directory
client.mv(
    "viking://resources/docs/temp.md",
    "viking://resources/archive/temp.md"
)

HTTP API

curl -X POST http://localhost:1933/api/v1/fs/mv \
  -H "Content-Type: application/json" \
  -H "X-API-Key: your-key" \
  -d '{
    "from_uri": "viking://resources/old-name/",
    "to_uri": "viking://resources/new-name/"
  }'
POST /api/v1/fs/mv

{
  "from_uri": "viking://resources/old-name/",
  "to_uri": "viking://resources/new-name/"
}

Parameters

from_uri
string
required
Source Viking URI (file or directory to move)
to_uri
string
required
Destination Viking URI (new location and/or name)

Response

status
string
Operation status (ok on success)
result
object
Result object containing source and destination URIs
time
number
Execution time in seconds
{
  "status": "ok",
  "result": {
    "from": "viking://resources/old-name/",
    "to": "viking://resources/new-name/"
  },
  "time": 0.1
}

CLI

openviking mv viking://resources/old-name/ viking://resources/new-name/

Notes

  • Both files and directories can be moved
  • The operation is atomic
  • If the destination already exists, it will be overwritten
  • All metadata and relations are preserved
  • Parent directories of the destination are created automatically if needed