Java Code Examples for org.apache.commons.io.FileUtils.moveDirectoryToDirectory()

The following are Jave code examples for showing how to use moveDirectoryToDirectory() of the org.apache.commons.io.FileUtils class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: wx-idk   File: FileIo.java   View Source Code Vote up 5 votes
/**
 * 移动目录
 * @author Rocye
 * @param srcPath 	移动目录的源路径
 * @param destPath 	移动目录的目的路径
 * @param isMoveRoot 是否移动根目录 true 为移动根目录 false 为不移动根目录,只移动根目录下的所有文件以及文件夹
 * @return true OR false
 * @version 2017-02-28
 */
public static boolean moveFolder(String srcPath, String destPath, boolean isMoveRoot) {
	try {
		if(isMoveRoot){
			FileUtils.moveDirectoryToDirectory(new File(srcPath), new File(destPath), true);
		}else{
			FileUtils.moveDirectory(new File(srcPath), new File(destPath));
		}
		return true;
	} catch (IOException e) {
		e.printStackTrace();
		logger.error("调用ApacheCommon移动文件夹时:" + e.toString());
		return false;
	}
}