Filesystem
Each account has an isolated filesystem rooted at /root/. All paths must start with /root/. Parent directories are created automatically on WRITE and MKDIR.
| Verb | Description |
|---|---|
WRITE "content" INTO "/root/file" | Write file — creates parents automatically |
WRITE ?var INTO "/root/file" AS "append" | Append to existing file |
READ "/root/file" SET ?c | Read file as text |
LIST "/root/" SET ?files | Array of names in directory |
LIST "/root/" AS "recursive" SET ?files | Recursive tree — returns full /root/ paths |
STAT "/root/file" SET ?meta | Metadata: name, size, modified, is_dir |
EXISTS "/root/path" SET ?bool | Check if path exists |
MKDIR "/root/dir" | Create directory and all parents |
COPY "/root/a" TO "/root/b" | Copy file |
COPY "/root/a" TO "/root/b" AS "recursive" | Copy directory tree |
MOVE "/root/a" TO "/root/b" | Move or rename |
REMOVE "/root/file" | Delete file or empty directory |
REMOVE "/root/dir" AS "recursive" | Delete directory and all contents |
CLEAR "/root/dir" | Delete directory contents, keep the directory itself |
SEARCH "/root/" WHERE "*.txt" | Glob search by filename |
SEARCH "/root/" WHERE "*.txt" AS "recursive" | Recursive glob |
FILE SELECT "f1" AND "f2" | Build a selection array for COMPRESS / COPY / MOVE |
COMPRESS ?selection AS "zip" INTO "/root/out.zip" | Archive: zip, tar, tar.gz, gz |
DECOMPRESS "/root/archive" INTO "/root/dir" | Extract archive |
SHARE "/root/file" SET ?url | Generate a public download URL at ocalt.com/files/{token} |
UNSHARE "/root/file" SET ?n | Revoke all share tokens for this file. Returns count revoked. |
WRITE / READ
WRITE "Engineering Magic" INTO "/root/hello.txt"
AFTER READ "/root/hello.txt" SET ?c
AFTER EMIT ?c
Try it ›
Append
WRITE "Line 1\n" INTO "/root/log.txt"
AFTER WRITE "Line 2\n" INTO "/root/log.txt" AS "append"
AFTER READ "/root/log.txt" SET ?c
AFTER EMIT ?c
Try it ›
EXISTS
EXISTS "/root/hello.txt" SET ?found
AFTER EMIT ?found
Try it ›
LIST and STAT
LIST "/root/" SET ?files
AFTER EMIT ?files
STAT "/root/hello.txt" SET ?meta
AFTER EMIT "Name: " & ?meta(name) & ", Size: " & ?meta(size) & " bytes"
Try it ›
COMPRESS
WRITE "file 1 content" INTO "/root/docs/a.txt"
AFTER WRITE "file 2 content" INTO "/root/docs/b.txt"
AFTER FILE SELECT "/root/docs/a.txt" AND "/root/docs/b.txt" SET ?sel
AFTER COMPRESS ?sel AS "zip" INTO "/root/archive.zip" SET ?out
AFTER SHARE ?out SET ?url
AFTER EMIT ?url
COPY / MOVE
(* Copy a single file *)
COPY "/root/report.txt" TO "/root/backup/report.txt"
(* Copy a directory tree *)
COPY "/root/docs" TO "/root/docs_backup" AS "recursive"
(* Move — same syntax, removes original *)
MOVE "/root/old_name.txt" TO "/root/new_name.txt"
Try it ›
REMOVE / CLEAR
(* Delete a file *)
REMOVE "/root/old.txt"
(* Delete a directory and all its contents *)
REMOVE "/root/tmp" AS "recursive"
(* Delete contents of a directory, keep the directory itself *)
CLEAR "/root/tmp"
Try it ›
SEARCH
Glob pattern matching on filename. * matches any characters, ? matches one character.
(* Find all text files in /root/ *)
SEARCH "/root/" WHERE "*.txt" SET ?files
AFTER EMIT ?files
Try it ›
(* Recursive — search all subdirectories too *)
SEARCH "/root/" WHERE "*.log" AS "recursive" SET ?logs
AFTER EMIT ?logs
LIST — recursive
(* Flat listing of one directory *)
LIST "/root/docs" SET ?files
AFTER EMIT ?files
(* Recursive — returns all paths under /root/ *)
LIST "/root/" AS "recursive" SET ?all
AFTER EMIT ?all
Try it ›
DECOMPRESS
DECOMPRESS "/root/archive.zip" INTO "/root/extracted"
AFTER LIST "/root/extracted" SET ?files
AFTER EMIT ?files
SHARE / UNSHARE
WRITE "hello" INTO "/root/report.txt"
AFTER SHARE "/root/report.txt" SET ?url
AFTER EMIT ?url
Try it ›
(* Revoke all share tokens for a file *)
UNSHARE "/root/report.txt" SET ?revoked
AFTER EMIT "Revoked " & ?revoked & " share links"
Upload pipeline
(* In Site Mode — receive uploaded file, convert to WebP, share *)
STAT !REQUEST(file:photo) SET ?meta
AFTER IF ?meta(size) IS GREATER THAN 5242880
OPEN NEST STATUS 413 AFTER EMIT "File too large" CLOSE NEST
ELSE
OPEN NEST
UUID SET ?id
AFTER CONVERT !REQUEST(file:photo) AS "webp"
INTO "/root/uploads/" & ?id & ".webp" SET ?webp
AFTER SHARE ?webp SET ?url
AFTER EMIT ?url
CLOSE NEST