(rontolisp) docs
← Functions

rename-file

(rename-file file new-name)

Renames (moves) file to new-name and returns the defaulted new name as a pathname. new-name is merged with file the way merge-pathnames merges, so a bare file name keeps the original directory. Anything that leaves the file where it was signals -- "it was not there" included, exactly like delete-file.

> (rename-file "notes.txt" "notes.bak")
#P"notes.bak"
> (rename-file "db/2026.up.sql" "2026.down.sql")
#P"db/2026.down.sql"

Lite deviation: Common Lisp returns (values defaulted-new-name old-truename new-truename) and this returns the defaulted new name only -- the same rule ensure-directories-exist follows, because a secondary value would not survive the function boundary on the compiled backends.

Backend support

Interpreter and JVM rename for real. Both WASM backends signal at CALL time: the WASI import set here carries no rename call, and "the file is at the new name afterwards" has no honest non-answer -- the same divergence delete-file and ensure-directories-exist have.