Here you can find the source of renameDirectory(File fromDir, File toDir)
public static boolean renameDirectory(File fromDir, File toDir)
//package com.java2s; //License from project: Open Source License import java.io.*; public class Main { public static boolean renameDirectory(File fromDir, File toDir) { if (fromDir.exists() && fromDir.isDirectory()) { if (fromDir.renameTo(toDir)) return true; else//from ww w . jav a2 s . com return false; } else return false; } }