Here you can find the source of copyFolder(File fin, File fout)
public static void copyFolder(File fin, File fout) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.*; import java.nio.channels.FileChannel; public class Main { public static void copyFolder(File fin, File fout) throws IOException { fout.mkdirs();//from ww w .j av a 2 s . com String[] children = fin.list(); if (children == null) { // Either dir does not exist or is not a directory } else { for (int p = 0; p < children.length; p++) { File f = new File(fin + "/" + children[p]); File f1 = new File(fout + "/" + children[p]); if (f.isDirectory()) copyFolder(f, f1); else copyFile(f, f1); } } } public static void copyFile(File source, File target) throws IOException { FileChannel sourceChannel = new FileInputStream(source) .getChannel(); FileChannel targetChannel = new FileOutputStream(target) .getChannel(); sourceChannel.transferTo(0, sourceChannel.size(), targetChannel); sourceChannel.close(); targetChannel.close(); } }