Here you can find the source of copyFolder(String path, String resultPath)
public static boolean copyFolder(String path, String resultPath)
//package com.java2s; //License from project: Open Source License import java.io.*; import java.nio.file.Files; import java.nio.file.StandardCopyOption; public class Main { public static boolean copyFolder(String path, String resultPath) { File file = new File(path); File result = new File(resultPath); try {/* w w w . j a va 2 s . c o m*/ Files.copy(file.toPath(), result.toPath(), StandardCopyOption.REPLACE_EXISTING); } catch (IOException e) { e.printStackTrace(); return false; } if (file.isDirectory()) { for (File other : file.listFiles()) { if (!copyFolder(other.getPath(), result.getPath() + "\\" + other.getName())) return false; } } return true; } }