Here you can find the source of renameFile(String from, String to, String baksuffix)
public static boolean renameFile(String from, String to, String baksuffix)
//package com.java2s; /**/* w w w . j av a 2 s .c om*/ * Title: efa - elektronisches Fahrtenbuch f?r Ruderer * Copyright: Copyright (c) 2001-2011 by Nicolas Michael * Website: http://efa.nmichael.de/ * License: GNU General Public License v2 * * @author Nicolas Michael * @version 2 */ import java.io.*; public class Main { public static boolean renameFile(String from, String to, String baksuffix) { try { File ffrom = new File(from); if (!ffrom.isFile()) { return false; } File fto = new File(to); if (fto.isFile()) { File fbak = new File(to + baksuffix); if (fbak.isFile()) { fbak.delete(); } fto.renameTo(fbak); } return ffrom.renameTo(fto); } catch (Exception e) { return false; } } }