List of utility methods to do Rename File
void | rename(String srcPath, String destPath) rename File file = new File(destPath); file.delete(); file = new File(srcPath); file.renameTo(new File(destPath)); |
boolean | rename(String strFileName, String strRenameToName) rename File f = new File(strFileName); if (f.exists()) { if (strRenameToName.indexOf('/') < 0) { strRenameToName = (f.getParent() + "/" + strRenameToName).replace("//", "/"); return f.renameTo(new File(strRenameToName)); return false; ... |
boolean | rename(String was_name, String new_name) rename File was_file = new File(was_name); File new_file = new File(new_name); System.err.println( "[IOUtils] renaming: " + was_file.getAbsolutePath() + " to: " + new_file.getAbsolutePath()); return was_file.renameTo(new_file); |
boolean | rename_file_to_file(String n1, String n2) renamfiltfile try { File f1 = new File(n1); File f2 = new File(n2); return (f1 != null && f2 != null ? f1.renameTo(f2) : false); } catch (SecurityException e) { return false; |
void | renameBackup(File backupFile) rename a file to name.n where n is 1..2 ..3 ... File parentDirectory = backupFile.getParentFile(); int index = 1; while (true) { File newName = new File(parentDirectory, backupFile.getName() + "." + index++); if (newName.exists()) continue; if (!backupFile.renameTo(newName)) throw new IllegalStateException("Cannot rename temporary file " + backupFile.getAbsolutePath() ... |
boolean | renameCanDelete() rename Can Delete if (rcdDone) return rcdValue; File a = null; File b = null; try { a = File.createTempFile("java-rename-check-", ""); b = File.createTempFile("java-rename-check-", ""); rcdValue = a.renameTo(b); ... |
void | renameContigs(File aliasFile, File cytobandFile, File seqDir) rename Contigs BufferedReader aliasReader = null; BufferedReader cytoReader = null; PrintWriter cytoWriter = null; File tmpCytoFile = new File(cytobandFile.getAbsolutePath() + ".tmp"); File backup = new File(cytobandFile.getAbsolutePath() + ".bak"); copyFile(cytobandFile, backup); try { aliasReader = new BufferedReader(new FileReader(aliasFile)); ... |
boolean | renameDirectory(File directory, File newDirectory) rename Directory try { if (directory.isDirectory()) { directory.renameTo(newDirectory); } else { directory.mkdir(); directory.renameTo(newDirectory); return true; ... |
boolean | renameDirectory(File fromDir, File toDir) rename Directory if (fromDir.exists() && fromDir.isDirectory()) { if (fromDir.renameTo(toDir)) return true; else return false; } else return false; |
boolean | renameDirectory(String in_currentDirectoryPath, String in_newDirectoryPath) Renames a directory. File currentDirectory = new File(in_currentDirectoryPath); if (currentDirectory.exists() == false || currentDirectory.isDirectory() == false) { return false; File newDirectory = new File(in_newDirectoryPath); if (newDirectory.exists() == true) { return false; if (currentDirectory.renameTo(newDirectory) == false) { return false; return true; |