Here you can find the source of renameFile(String origPath, String destPath)
true
if successfully renamed
public static boolean renameFile(String origPath, String destPath)
//package com.java2s; /******************************************************************************* * Copyright (c) 2012 Firestar Software, Inc. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors:/*from w ww.ja v a 2 s . c om*/ * Firestar Software, Inc. - initial API and implementation * * Author: * Gabriel Oancea * *******************************************************************************/ import java.io.*; public class Main { /** * Rename a file. Just like File.renameTo(), but logs failure. * * @return <code>true</code> if successfully renamed */ public static boolean renameFile(String origPath, String destPath) { File orig = new File(origPath); File dest = new File(destPath); if (!orig.exists() || dest.exists()) return false; return orig.renameTo(dest); } }