Here you can find the source of renameFile(String filePath, String descFilePath)
public static boolean renameFile(String filePath, String descFilePath)
//package com.java2s; /*/* w ww . j a v a 2 s .co m*/ * Copyright 2016 Yonyou Corporation Ltd. All Rights Reserved. * * This software is published under the terms of the Yonyou Software * License version 1.0, a copy of which has been included with this * distribution in the LICENSE.txt file. * * @Project Name : cmol.common.function * * @File name : IOUtils.java * * @Author : zhangxianchao * * @Date : 2016?2?29? * ---------------------------------------------------------------------------------- * Date Who Version Comments * 1. 2016?2?29? zhangxianchao 1.0 * * * * ---------------------------------------------------------------------------------- */ import java.io.File; public class Main { /** * rename file */ public static boolean renameFile(String filePath, String descFilePath) { File file = new File(filePath); if (!file.exists()) { return false; } File descFile = new File(descFilePath); if (descFile.exists()) { return false; } return file.renameTo(descFile); } }