copy

abstract suspend fun copy(source: Path, target: Path)(source)

Copies a file or directory from source to target. If the source is a directory, all its contents are copied recursively. Parent directories of the target will be created if they don't exist.

Parameters

source

The source path to copy from.

target

The target path to copy to.

Throws

IOException

or its inheritor if the source doesn't exist, isn't a file or directory, target already exists, or any I/O error occurs.