Here you can find the source of renameFile(File file, String newFilename)
Parameter | Description |
---|---|
file | a parameter |
newFilename | a parameter |
public static boolean renameFile(File file, String newFilename)
//package com.java2s; import java.io.File; public class Main { /**//from www . j ava 2s . c om * * @author Marquis * @Create Date: 2008-3-29 * @param file * @param newFilename * @return if the operation is success return true else return false */ public static boolean renameFile(File file, String newFilename) { if (file.exists() == false) return false; String path = file.getPath(); File new_file = new File(path + File.separator + newFilename); return file.renameTo(new_file); } }