Here you can find the source of renameFile(String sourcePath, String targetPath)
public static Boolean renameFile(String sourcePath, String targetPath) throws IOException
//package com.java2s; //License from project: Apache License import java.io.File; import java.io.IOException; public class Main { public static Boolean renameFile(String sourcePath, String targetPath) throws IOException { File oldFile = new File(sourcePath); File newFile = new File(targetPath); if (oldFile.isFile()) { oldFile.renameTo(newFile);/*from w w w . j a v a2s . co m*/ return true; } else { return false; } } }