Here you can find the source of copyFolderNio(String oldpathall, String newpath)
public static void copyFolderNio(String oldpathall, String newpath) throws IOException
//package com.java2s; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.nio.channels.FileChannel; public class Main { public static void copyFolderNio(String oldpathall, String newpath) throws IOException { String newpathall = newpath + File.separator + new File(oldpathall).getName(); FileChannel inputChannel = null; FileChannel outputChannel = null; try {/*from ww w .ja v a 2 s . co m*/ inputChannel = new FileInputStream(oldpathall).getChannel(); outputChannel = new FileOutputStream(newpathall).getChannel(); outputChannel.transferFrom(inputChannel, 0, inputChannel.size()); } finally { inputChannel.close(); outputChannel.close(); } } }