package org
.westos
.demo7
;
import java
.io
.*
;
public class MyTest2 {
public static void main(String
[] args
) throws IOException
{
FileInputStream in
= null
;
FileOutputStream out
= null
;
File file
= new File("C:\\Users\\Administrator\\Desktop\\abc");
File
[] files
= file
.listFiles();
for (File file1
: files
) {
if (file1
.isFile()) {
in
= new FileInputStream(file
+ "\\"+file1
.getName());
out
= new FileOutputStream("E:\\test\\"+file1
.getName());
int len
= 0;
byte[] bytes
= new byte[1024 * 8];
while ((len
= in
.read(bytes
)) != -1) {
out
.write(bytes
,0,len
);
out
.flush();
}
}
}
out
.close();
in
.close();
}
}
转载请注明原文地址: https://mac.8miu.com/read-493503.html