overwrite.
from gravixlayer import GravixLayer
client = GravixLayer() # defaults to cloud="aws", region="us-east-1"
sandbox = client.runtime.create() # defaults to template="base-small"
sandbox.file.write("/workspace/draft.txt", "hello\n")
result = sandbox.file.move("/workspace/draft.txt", "/workspace/final.txt")
print(result.success, result.source, result.destination)
sandbox.kill()
import { GravixLayer } from 'gravixlayer';
const client = new GravixLayer(); // defaults to cloud="aws", region="us-east-1"
const sandbox = await client.runtime.create(); // defaults to template="base-small"
await sandbox.file.write("/workspace/draft.txt", "hello\n");
const result = await sandbox.file.move("/workspace/draft.txt", "/workspace/final.txt");
console.log(result.success, result.source, result.destination);
await sandbox.kill();
gravixlayer runtime files mv "$RT" /workspace/draft.txt /workspace/final.txt
curl -X POST "https://api.gravixlayer.ai/v1/agents/runtime/$RT/files/move" \
-H "Authorization: Bearer $GRAVIXLAYER_API_KEY" \
-H "Content-Type: application/json" \
-d '{"source": "/workspace/draft.txt", "destination": "/workspace/final.txt"}'
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
source | string | Yes | Existing absolute path |
destination | string | Yes | New absolute path |
overwrite | boolean | No | Replace destination if it already exists. Defaults to false |
Response
| Field | Type | Description |
|---|---|---|
success | boolean | Whether the move succeeded |
source | string | The path that was moved |
destination | string | The path it now occupies |
entry | object | FileInfo for the destination, when it is reported |
Endpoint
POST /v1/agents/runtime/{runtime_id}/files/move