Java Rename File renameDirectory(File directory, File newDirectory)

Here you can find the source of renameDirectory(File directory, File newDirectory)

Description

rename Directory

License

Open Source License

Declaration

public static boolean renameDirectory(File directory, File newDirectory) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.io.File;

public class Main {
    public static boolean renameDirectory(File directory, File newDirectory) {
        try {/*from  w  w  w .j  av  a  2  s  .c o m*/
            if (directory.isDirectory()) {
                directory.renameTo(newDirectory);
            } else {
                directory.mkdir();
                directory.renameTo(newDirectory);
            }
            return true;
        } catch (Exception ex) {
            return false;
        }
    }
}

Related

  1. rename(String was_name, String new_name)
  2. rename_file_to_file(String n1, String n2)
  3. renameBackup(File backupFile)
  4. renameCanDelete()
  5. renameContigs(File aliasFile, File cytobandFile, File seqDir)
  6. renameDirectory(File fromDir, File toDir)
  7. renameDirectory(String in_currentDirectoryPath, String in_newDirectoryPath)
  8. renameDirectory(String newDir, String oldDir)
  9. renameExcludedFiles(File existingBinaryFolder, Collection excludedBids)