Here you can find the source of recursiveCopyDir(File source, File destination)
private static void recursiveCopyDir(File source, File destination) throws IOException
//package com.java2s; //License from project: Apache License import com.google.common.io.Files; import java.io.*; public class Main { private static void recursiveCopyDir(File source, File destination) throws IOException { if (source.isDirectory()) { if (!destination.exists()) { if (!destination.mkdirs()) { throw new IOException("The destination directory could not be created."); }/*from ww w. ja va 2 s .c o m*/ } String files[] = source.list(); for (String file : files) { File srcFile = new File(source, file); File destFile = new File(destination, file); recursiveCopyDir(srcFile, destFile); } } else { Files.copy(source, destination); } } }