Here you can find the source of rename(String strFileName, String strRenameToName)
Parameter | Description |
---|---|
strFileName | a parameter |
strRenameToName | a parameter |
public static boolean rename(String strFileName, String strRenameToName)
//package com.java2s; import java.io.File; public class Main { public static boolean rename(String strFileName, String strRenameToName) { File f = new File(strFileName); if (f.exists()) { if (strRenameToName.indexOf('/') < 0) { strRenameToName = (f.getParent() + "/" + strRenameToName).replace("//", "/"); }/*from w ww .j a v a 2s . c om*/ return f.renameTo(new File(strRenameToName)); } return false; } }