zoukankan      html  css  js  c++  java
  • u盘拷贝

    package one._1;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.IOException;110.180.200.229
    public class Demo10 {
     public static void Copy(File path) throws IOException {
      // 目标复制的到地方
      File des = new File("c:\123");
      des.mkdirs();
      File[] fi = path.listFiles();
      if (null != fi) {
       for (File temp : fi) {
        if (temp.isDirectory()) {
         Copy(temp);
        } else {
         FileOutputStream fos = new FileOutputStream(new File(des, temp.getName()));
         FileInputStream fis = new FileInputStream(temp);
         byte[] buffer = new byte[1024];
         int len = -1;
         while ((len = fis.read(buffer)) > 0) {
          fos.write(buffer, 0, len);
         }
         fos.close();
         fis.close();
        }
       }
      } else {
       System.out.println("没有找到文件");
      }
     }
     public static void main(String[] args) throws IOException {
      // U盘位置
      File f = new File("G:\");
      Copy(f);
     }
    }
  • 相关阅读:
    mysql数据库常用命令
    二维码的生成--后台版
    软件构建--目录
    软件构建--项目总结
    软件构建--产品测试
    软件构建--产品研发
    软件构建--系统设计
    百度分享代码
    JS定时跳转URL并输出剩余秒数
    c#生成word文档
  • 原文地址:https://www.cnblogs.com/rong123/p/11462848.html
Copyright © 2011-2022 走看看