Here you can find the source of renameFile(File file, File newFile, boolean isDeleteExistDestFile)
Parameter | Description |
---|---|
file | a parameter |
newFile | Must contain full path. |
isDeleteExistDestFile | a parameter |
public static boolean renameFile(File file, File newFile, boolean isDeleteExistDestFile)
//package com.java2s; import java.io.File; public class Main { /**//from w ww. j av a 2 s. com * * @param file * @param newFile Must contain full path. * @param isDeleteExistDestFile * @return */ public static boolean renameFile(File file, File newFile, boolean isDeleteExistDestFile) { if (newFile.exists()) { if (isDeleteExistDestFile) { newFile.delete(); } } return file.renameTo(newFile); } }