Capy-Bearer Documentation

file_rename

host call

Capy

function file_rename(from : string, to : string) bool

Description

file_rename changes a file path. The source path no longer exists after a successful call.

Parameters

from : source path

to : destination path

Return Values

true if Capy renames the file. Otherwise, false.

Example

Capy

file_put_contents("/tmp/doc-rename-source.txt", "moved")
if file_rename("/tmp/doc-rename-source.txt", "/tmp/doc-rename-destination.txt") {
    print(file_get_contents("/tmp/doc-rename-destination.txt"), "\n")
}