copy

common
open fun copy(source: Path, target: Path)

Copies all of the bytes from the file at source to the file at target. This does not copy file metadata like last modified time, permissions, or extended attributes.

This function is not atomic; a failure may leave target in an inconsistent state. For example, target may be empty or contain only a prefix of source.

Throws

if source cannot be read or if target cannot be written.

js
open fun copy(source: Path, target: Path)

Throws