// File srcFolder=new File("c:\demo");
// File destFolder=new File("d:\test");
// if(!destFolder.exists()){
// destFolder.mkdir();
//
// }
// File[] fileArray=srcFolder.listFiles();
//
// for(File file:fileArray){
// System.out.println(file);
//
// String name=file.getName();
// File newFile=new File(destFolder,name);
// System.out.println(newFile);
// // copyFile(file,newFile);
// }
}
private static void copyFile(File file, File newFile) throws IOException {
BufferedInputStream bis=new BufferedInputStream(new FileInputStream(file));
BufferedOutputStream bos=new BufferedOutputStream(new FileOutputStream(newFile));
byte[] bys=new byte[1024];
int len=0;
while((len=bis.read(bys))!=-1){
bos.write(bys,0,len);
}
bos.close();
bis.close();
}
}