Here you can find the source of copyDir(String src, String dst)
public static void copyDir(String src, String dst)
//package com.java2s; //License from project: Apache License import java.io.File; import java.io.IOException; import java.nio.file.Files; import java.nio.file.StandardCopyOption; public class Main { public static void copyDir(String src, String dst) { copyDir(new File(src), new File(dst)); }//from w ww .ja v a 2 s . c o m public static void copyDir(File src, File dst) { if (src.isDirectory()) { dst.mkdirs(); File[] files = src.listFiles(); if (files != null) for (File i : files) { File j = new File(dst.getAbsolutePath() + File.separatorChar + i.getName()); if (i.isDirectory()) copyDir(i, j); else copyFile(i, j); } } } public static void copyFile(File src, File dst) { try { Files.copy(src.toPath(), dst.toPath(), StandardCopyOption.COPY_ATTRIBUTES, StandardCopyOption.REPLACE_EXISTING); } catch (IOException x) { x.printStackTrace(); } } }