Here you can find the source of moveFile(Path source, Path target, boolean prompt)
private static void moveFile(Path source, Path target, boolean prompt)
//package com.java2s; /*/*from w w w . ja va 2s . c o m*/ * Copyright (C) 2011-2014 by Ahmed Osama el-Sawalhy * * The Modified MIT Licence (GPL v3 compatible) * License terms are in a separate file (LICENCE.md) * * Project/File: Overcast/com.yagasoft.overcast.base.container/FolderHelper.java * * Modified: Apr 15, 2014 (8:06:38 AM) * Using: Eclipse J-EE / JDK 7 / Windows 8.1 x64 */ import static java.nio.file.StandardCopyOption.REPLACE_EXISTING; import java.io.IOException; import java.nio.file.CopyOption; import java.nio.file.Files; import java.nio.file.Path; public class Main { private static void moveFile(Path source, Path target, boolean prompt) { CopyOption[] options = new CopyOption[] { REPLACE_EXISTING }; if (!prompt || Files.notExists(target)) // || okayToOverwrite(target)) { try { Files.move(source, target, options); } catch (IOException x) { System.err.format("Unable to copy: %s: %s%n", source, x); } } } }