copy

open suspend override 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. The operation is performed with Dispatchers.IO context.

Parameters

source

The source path to copy from.

target

The target path to copy to.

Throws

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