file_copy
lib callCapy
function file_copy(from : string, to : string) any
Description
file_copy copies a file to another path. The source path remains available after a successful copy.
Parameters
from : source path
to : destination path
Return Values
A map with ok and error. ok is true when Capy copies the file. error holds the failure reason when the call fails.
Example
Capy
file_put_contents("/tmp/doc-copy-src.txt", "payload")
file_copy("/tmp/doc-copy-src.txt", "/tmp/doc-copy-dst.txt")
print(file_get_contents("/tmp/doc-copy-dst.txt").value ?? "", "\n")
Output
payload