Here you can find the source of copy(File source, File dest)
public static void copy(File source, File dest) throws IOException
//package com.java2s; //License from project: Apache License import java.io.File; import java.io.IOException; import java.nio.file.Files; public class Main { public static void copy(File source, File dest) throws IOException { Files.copy(source.toPath(), dest.toPath()); if (source.isDirectory()) { for (String s : source.list()) { copy(new File(source, s), new File(dest, s)); }/*w ww.jav a2s .c o m*/ } } }