moveTo

JVM
JRE7
1.5
fun Path.moveTo(
    target: Path,
    vararg options: CopyOption
): Path

(source)

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

Parameters

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

Exceptions

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

DirectoryNotEmptyException - 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).

See Also

Files.move

JVM
JRE7
1.5
fun Path.moveTo(
    target: Path,
    overwrite: Boolean = false
): Path

(source)

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

Parameters

overwrite - allows to overwrite the target if it already exists.

Exceptions

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

DirectoryNotEmptyException - 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).

See Also

Files.move