package com.botao;

import java.io.*;

/**
* @author cbt28
*/
public class FileUtil {
public static String a="";
public static String b=""; public static void copyDir(File src, File target) throws IOException {
if (!target.exists()) {
target.mkdir();
}
File[] lf = src.listFiles();
for (File file : lf) {
if (file.isFile()) {
System.out.println(src + "\\" + file.getName() + "--->" + target + "\\" + file.getName());
boolean b = copyFile(new File(src + "\\" + file.getName()), new File(target + "\\" + file.getName()));
System.out.println(b);
} else {
copyDir(new File(src + "\\" + file.getName()), new File(target + "\\" + file.getName()));
}
}
} public static boolean copyFile(File src, File target) throws IOException {
FileReader fr = new FileReader(src);
BufferedReader br = new BufferedReader(fr); FileWriter fw = new FileWriter(target);
BufferedWriter bw = new BufferedWriter(fw);
String s = br.readLine();
while (s != null) {
bw.write(s);
bw.newLine();
s = br.readLine();
}
bw.close();
fw.close();
br.close();
fr.close();
return true;
}
}

最新文章

  1. checkbox选中状态不被改变
  2. java 22 - 6 多线程之线程调度和设置线程的优先级
  3. IO/ACM中来自浮点数的陷阱(收集向)
  4. 在ubuntu(linux)下安装vim,以及vim的常用命令
  5. How to Write Doc Comments for the Javadoc Tool
  6. C++:四种必须使用初始化列表情况
  7. Oracle的OracleBulkCopy不支持事务处理
  8. iscc2016 mobile1-TurtleShell.apk解题过程
  9. 背水一战 Windows 10 (38) - 控件(布局类): Panel, Canvas, RelativePanel, StackPanel, Grid
  10. linux下ClamAV使用
  11. 十一招让Ubuntu 16.04用起来更得心应手(转)
  12. arcgis api for js入门开发系列十六迁徙流动图
  13. Box布局
  14. 开发高性能JAVA应用程序基础(集合篇)
  15. [HAOI 2010]软件安装
  16. Pandas系列(九)-分组聚合详解
  17. Callable抛出异常与future.get
  18. 91. Reverse Linked List 反转链表
  19. 【Java】 剑指offer(39) 数组中出现次数超过一半的数字
  20. java:@SuppressWarnings注解

热门文章

  1. python - 平方根格式化 + 字符串分段组合
  2. oeasy教您玩转linux010109clear清屏
  3. Unity2018.4.7导出Xcode工程报错解决方案
  4. MySQL 增删查改 必知必会
  5. 安装cnpm设置npm淘宝镜像源
  6. 修改CentOS的yum源,改为阿里云的镜像
  7. idea报错cannot resolve symbol servlet
  8. agumaster 出现实际股票数据
  9. SpringMVC-结果跳转方式
  10. Python中的type(),isinstance,()dir(),的区别