Java Utililty Methods Rename File

List of utility methods to do Rename File

Description

The list of methods to do Rename File are organized into topic(s).

Method

voidrename(final String src, final String dst)
Renames the file with the given name
new File(src).renameTo(new File(dst));
voidrename(String existingFile, String newFilename)
rename
if (exists(existingFile)) {
    File oldFile = new File(existingFile);
    oldFile.renameTo(new File(newFilename));
booleanrename(String fileName, String distFile)
rename
synchronized (fileName) {
    File oldFile = new File(fileName);
    if (oldFile.exists()) {
        try {
            oldFile.renameTo(new File(distFile));
            return true;
        } catch (Exception e) {
            e.printStackTrace();
...
booleanrename(String from, String to)
rename
File fFrom = new File(from);
File fTo = new File(to);
if (!fFrom.exists()) {
    return false;
} else {
    return fFrom.renameTo(fTo);
booleanrename(String oldFile, String newFile)
rename
File old = new File(oldFile);
return old.renameTo(new File(newFile));
booleanrename(String oldName, String newName)
Renames a file or directory.
File fold = new File(oldName);
File fnew = new File(newName);
return fold.renameTo(fnew);
voidreName(String oldName, String newName)
re Name
File oldF = new File(oldName);
File newF = new File(newName);
boolean renameTo = oldF.renameTo(newF);
if (!renameTo) {
    return;
voidrename(String platformLibPath, String newPath)
rename
new File(platformLibPath).renameTo(new File(newPath));
voidreName(String s, String s1)
re Name
File file1 = new File(s);
if (file1.exists()) {
    file1.renameTo(new File(s1));
booleanrename(String srcFilename, String destFilename)
renames a file to the new filename
File srcFile;
File destFile;
boolean result = false;
srcFile = new File(srcFilename);
destFile = new File(destFilename);
try {
    result = srcFile.renameTo(destFile);
} catch (Exception e) {
...