public static void getw(File yuan, File mudi) throws IOException {
File xinjian = new File(mudi, yuan.getName());
xinjian.mkdir();
File[] a = yuan.listFiles();
for (File file : a) {
if (file.isFile()) {
BufferedInputStream bf = new BufferedInputStream(
new FileInputStream(file));
BufferedOutputStream bo = new BufferedOutputStream(
new FileOutputStream(xinjian + "\\" + file.getName()));
int len;
while ((len = bf.read()) != -1) {
bo.write(len);
}
bf.close();
bo.close();
} else {
getw(file, xinjian);
}
}
} |
|