Here you can find the source of backup(String inputFile, String backupFile)
public static boolean backup(String inputFile, String backupFile)
//package com.java2s; //License from project: Open Source License import java.io.File; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.StandardCopyOption; public class Main { public static boolean backup(String inputFile, String backupFile) { return backup(new File(inputFile), new File(backupFile)); }// w w w . j av a 2 s. co m public static boolean backup(File inputFile, String backupFile) { return backup(inputFile, new File(backupFile)); } public static boolean backup(String inputFile, File backupFile) { return backup(new File(inputFile), backupFile); } public static boolean backup(File inputFile, File backupFile) { Path input = inputFile.toPath(), backup = backupFile.toPath(); try { Files.move(input, backup, StandardCopyOption.REPLACE_EXISTING); } catch (Exception err) { System.err.println(err.getMessage()); err.printStackTrace(); return false; } return true; } }