static FileInputStream in = null;
static FileOutputStream out = null;
static BufferedInputStream buffin = null;
static BufferedOutputStream buffout = null;
public static void main(String[] args) throws Exception {
File file = new File("E:\\myuser\\wen1");
List<File> list = new ArrayList<File>();
fileList(file, list);
CopyFileJava(list);
}
public static void CopyFileJava(List<File> list) throws Exception {
byte[] buff = new byte[1024];
int len = 0;
try {
for (File file : list) {
String name = file.getName();
out = new FileOutputStream("E:\\myuser\\my\\");
in = new FileInputStream(file.toString());
buffin = new BufferedInputStream(in);
buffout = new BufferedOutputStream(out);
while ((len = buffin.read(buff)) != -1) {
buffout.write(buff, 0, len);
}
}