public static void copysrcDirTodestDir(File src,File dest) throws IOException{
File[] filelist = src.listFiles();
File newDir = new File(dest,src.getName());
if(!newDir.exists()){
newDir.mkdirs();
}
for (File file : filelist) {
if(!file.isDirectory()){
BufferedInputStream bis = new BufferedInputStream(new FileInputStream(file));
BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(new File(newDir,file.getName())));
int len=0;
byte[] b = new byte[1024];
while((len = bis.read(b))!=-1){
bos.write(b, 0, len);
}
bis.close();
bos.close();
}else {
copysrcDirTodestDir(file, newDir);
}
}
}