Delete a file or directory from the Viking filesystem.
Python SDK
from openviking import OpenViking
client = OpenViking()
# Remove a single file
client.rm( "viking://resources/docs/old.md" )
# Remove directory recursively
client.rm( "viking://resources/old-project/" , recursive = True )
HTTP API
Remove File
Remove Directory
curl -X DELETE "http://localhost:1933/api/v1/fs?uri=viking://resources/docs/old.md" \
-H "X-API-Key: your-key"
DELETE /api/v1/fs?uri=viking://resources/docs/old.md
Parameters
Viking URI of the file or directory to remove
Remove directory and all its contents recursively
Response
Operation status (ok on success)
Result object containing the removed URI Viking URI of the removed resource
Execution time in seconds
{
"status" : "ok" ,
"result" : {
"uri" : "viking://resources/docs/old.md"
},
"time" : 0.1
}
CLI
# Remove file
openviking rm viking://resources/old.md
# Remove directory recursively
openviking rm viking://resources/old-project/ --recursive
Error Cases
Attempting to remove a non-empty directory without recursive=true will fail
Removing a non-existent resource returns an error
The operation cannot be undone
This operation permanently deletes resources. Use with caution, especially with recursive=true.