moveTo

inline fun Path.moveTo(target: Path, vararg options: CopyOption): Path(source)

Moves or renames the file located by this path to the target path.

Since Kotlin

1.5

Parameters

options

options specifying how the move should be done, see StandardCopyOption, LinkOption.

See also

Throws

if the target file exists but cannot be replaced because the StandardCopyOption.REPLACE_EXISTING option is not specified (optional specific exception).

the StandardCopyOption.REPLACE_EXISTING option is specified but the file cannot be replaced because it is a non-empty directory, or the source is a non-empty directory containing entries that would be required to be moved (optional specific exception).


inline fun Path.moveTo(target: Path, overwrite: Boolean = false): Path(source)

Moves or renames the file located by this path to the target path.

Since Kotlin

1.5

Parameters

overwrite

allows to overwrite the target if it already exists.

See also

Throws

if the target file exists but cannot be replaced because the overwrite = true option is not specified (optional specific exception).

the overwrite = true option is specified but the file cannot be replaced because it is a non-empty directory, or the source is a non-empty directory containing entries that would be required to be moved (optional specific exception).