Following code can be used to move a file from one place to other place. After transfer, it gives a confirmation message if transfer was successful.

Java Code:
// file to be moved
File file = new File("File.txt");

// file to be moved to this destination
File dir = new File("./directory");

// Move file to a new directory
boolean success = file.renameTo(new File(dir, file.getName()));

if (success) {
    System.out.println("File was successfully moved.");
} else {
    System.out.println("File was not successfully moved.");